LESSON 4.2 · ABOUT 20 MINUTES
Marginals & conditional distributions
Collapse a table or restrict it to the information you know.
By the end of this lesson
- Calculate marginal distributions.
- Normalize a conditional distribution and test independence.
Marginals
Add across a row to obtain p_X(x); add down a column to obtain p_Y(y). You are allowing the other variable to take any of its possible values.
Conditioning
To find p(X=x | Y=y), divide p(x,y) by p_Y(y), provided p_Y(y)>0. Within the selected column, the conditional probabilities sum to one. Conditioning on a zero-probability event is undefined.
Independence
X and Y are independent only if p(x,y)=p_X(x)p_Y(y) for EVERY pair. Finding one mismatch disproves independence. A matching pair by itself does not prove it.
p(x | y) = p(x,y) / p_Y(y)
Worked example
Use [[0.1,0.2],[0.3,0.4]]. Find P(X=1 | Y=0).
Column Y=0 has probability 0.1+0.3=0.4. The selected joint mass is 0.3, so the conditional probability is 0.3/0.4=0.75.