How to generate three random variable $a, b, c$ of some distributions that satisfy: $$a \in [0, 0.5]$$ $$b \in [0, 0.4]$$ $$c \in [0, 0.3]$$ $$a+b+c = 1$$
2026-03-31 22:20:45.1774995645
On
Conditional random variables
91 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
Another way to do this is to embed your problem in a 2-D subspace:
- Associate $a\rightarrow x$, $b\rightarrow y$,$c\rightarrow z$
- Let $u=(-1,0,1),v=(-1,1,0)$ be be two vectors that span the solution space of $x+y+z=1$
- Let $\lambda_1,\lambda_2 \sim U(0,1)$
- Set $P=\lambda_1u+\lambda_2v+(1,0,0)$ (we're starting from the solution $x=1,y=z=0$)
- Check the components of $P:P_i \in [0,M_i]$ where $M_i$ is the upper bounds of the associated variables.
- If so, then accept the answer as a validate draw from the joint distribution, otherwise reject and repeat.
However, your marginals will not match what you specified because each variable MUST be >0 to achieve your constraint. In particular, $a\in [.3,.5], b\in [.2,.4],c\in[.2,.3]$
The first three conditions define a shoebox in 3d, while the fourth condition is a plane slicing through. Luckily its intersection is a simple shape, namely a triangle with vertices at $(0.5,0.2,0.3), (0.3, 0.4,0.3), (0.5, 0.4, 0.1)$. Choose a point uniformly on this skew triangle. This is not the only possible construction, but I think a case could be made that this is the most natural one to provide "uniform" distributions.
Note: one way to get a point on this triangle is to choose $\lambda, \mu, \kappa$ each uniformly in $[0,1]$ and then your desired point is $$\frac{\lambda}{\lambda+\mu+\kappa}(0.5,0.2,0.3)+\frac{\mu}{\lambda+\mu+\kappa}(0.3,0.4,0.3)+\frac{\kappa}{\lambda+\mu+\kappa}(0.5,0.4,0.1)$$
However, as the comments point out, this is not uniform, and tends to cluster near the center of the triangle.