I am trying to calculate the marginal distribution P(X) of the following joint distribution P(X, Y).
y=0 | y=1 | y=2 | |
---|---|---|---|
x=0 | .2 | .1 | .2 |
x=1 | 0 | .2 | .1 |
x=2 | .1 | 0 | .1 |
Here is how I am calculating $P(X=0) = P(X = 0, Y=0) + P(X = 0, Y=1) + P(X = 0, Y=3) = .2 + .1 + .2 = .5$. Similarly I can find P(X=1) = .3 and P(X=2) = .2, and this looks like the correct approach since P(X = 0) + P(X = 1) + P(X = 2) =1
But if I break the $P(X,Y)$ term using the chain rule, I get a different answer. (I've calculated P(Y) by adding the columns.)
$$ \begin{align} P(X=0) &= P(X = 0, Y=0) + P(X = 0, Y=1) + P(X = 0, Y=3) \\ &= P(X =0| Y=0) P(Y=0) + P(X =0| Y=1) P(Y=1) + P(X =0| Y=2) P(Y=2) \\ &= .2 * .3 + .1 * .3 + .2 * .4 \\ &= 0.17 \end{align} $$
In this approach, P(X=1) = .1 and P(X=2) = .07, and they do not add up to 1.
Why do the results differ when I expand $P(X,Y)$ using the chain rule?