I'm trying to do an assignment of generating 3 random variables $A,B,C$ such that
- $A$ and $B$ are not independent
- $A$ and $B$ are independent given $C$
- $A >= 3$, $B<=9$, $C$ is binary.
- $P(1<=A<=5) = 0.4$
- $P(1<=B<=5) = 0.4$
- $P(C=0) = 0.3$
For the binary case without constraints, its pretty straight forward, here is an example:
Example: X,Y,Z $\in \{1,2\}$ $$P(X=1,Y=1,Z=1) = P(X=1,Y=2,Z=1) = P(X=2,Y=1,Z=1) = P(X=2,Y=2,Z=1) = \frac{1}{12}$$ $$P(X=1,Y=1,Z=2) = P(X=1,Y=2,Z=2) = P(X=2,Y=1,Z=2) = P(X=2,Y=2,Z=2) = \frac{1}{6}$$
Now $P(X=1,Y=1|Z=1) = \frac{1}{4}$ and $P(X=1|Z=1) = \frac{1}{2}$, $P(Y=1|Z=1) = \frac{1}{2}$
So: $P(X=1,Y=1|Z=1) = P(X=1|Z=1)*P(Y=1|Z=1)$, and similary the other values.
But with the constaint, I can't figure out how to generate these random variables.. any help would be appreciated.