Sampling random numbers with a certain condition.

60 Views Asked by At

I want to randomly sample three variables that are conditioned by $$x_1 \le x_2 \le x_3$$ and $x_1\in [0,\, \ell]$, $x_2\in [0,\, \ell-\ell_1]$ and $x_3 \in [0, \,\ell-\ell_1-\ell_2]$.

I have only limited statistics knowledge. Would you help me on how to do this using Matlab?

1

There are 1 best solutions below

7
On

Your ranges are inconsistent with your stated condition: $max(x_3)<max(x_2)<max(x_1)$ yet you are conditioning them to have the opposite general relationship. This will result in the actual range of x values being constrained to $x_3$'s interval of $[0, \,\ell-\ell_1-\ell_2]$.

To generate conditional values, you would choose them in succession:

  1. Select $x_3$ from $[0, \,\ell-\ell_1-\ell_2]$
  2. Select $x_2$ from $[0, x_3]$
  3. Select $x_1$ from $[0, x_2]$

Of course, you need to decide on a distribution for the x's (perhaps uniform distribution?) but following the above will get you the correct conditional values.