5.1Joint and marginal distributions, independence of variables
The idea
A joint distribution describes two random variables at once, usually as a table. Marginals are the row and column totals. The variables are independent when every cell equals the product of its margins.
Think of it like this: A table of students by (height class, weight class): the row totals describe height alone, the column totals describe weight alone.
Why it exists
Joint tables lead to covariance, correlation and independence tests of random variables.
How it works
- Fill the table p(x, y) = P(X = x, Y = y); all cells add to 1.
- Marginal p_X(x) = the row sum; p_Y(y) = the column sum.
- Independent ⇔ p(x, y) = p_X(x) p_Y(y) for every cell.
- E[XY] = Σ x y p(x, y).
- One cell that does not match is enough to show dependence.
Worked example: The independent preset
Row totals 0.2, 0.3, 0.5 and column totals 0.2, 0.4, 0.4. Every cell equals (row total) × (column total), for instance p(0, 0) = 0.2 × 0.2 = 0.04. The lab confirms independence and Cov = 0.
Now play with it
- →Load "Y = X (perfectly dependent)" and see the independence check fail.
- →Edit one cell of the independent table and watch the check break.
| P(X = i, Y = j) | Y = 0 | Y = 1 | Y = 2 | P(X = i) |
|---|---|---|---|---|
| X = 0 | 0.2 | |||
| X = 1 | 0.3 | |||
| X = 2 | 0.5 | |||
| P(Y = j) | 0.2 | 0.4 | 0.4 | 1 |
✓ independent: every cell equals (row total) × (column total)
Independent ⇒ Cov = 0, but Cov = 0 does not imply independent (see the last example: Y = (X − 1)² is a function of X, yet the covariance is 0). Always Var(X + Y) = Var X + Var Y + 2Cov(X, Y).
| P(X = i, Y = j) | Y = 0 | Y = 1 | Y = 2 | P(X = i) |
|---|---|---|---|---|
| X = 0 | 0.3 | |||
| X = 1 | 0.4 | |||
| X = 2 | 0.3 | |||
| P(Y = j) | 0.3 | 0.4 | 0.3 | 1 |
✗ not independent: some cell differs from (row total) × (column total)
Independent ⇒ Cov = 0, but Cov = 0 does not imply independent (see the last example: Y = (X − 1)² is a function of X, yet the covariance is 0). Always Var(X + Y) = Var X + Var Y + 2Cov(X, Y).
Check yourself
The table has P(X = 0, Y = 0) = 0.3 while P(X = 0) = 0.5 and P(Y = 0) = 0.5. Are X and Y independent?
Exam notes (the dense version)
The joint PMF p(x, y) = P(X = x, Y = y). Marginals are row and column sums: pₓ(x) = Σᵧ p(x, y). X and Y are independent iff p(x, y) = pₓ(x) pᵧ(y) for every cell, equivalently the table is the product of its margins.
Previous year questions: Joint Distributions, Covariance & Conditional Expectation (2)
PYQs are grouped by topic, so this is the full set for Joint Distributions, Covariance & Conditional Expectation; try the ones that match this subtopic. Open all 2 on the topic page.