Math for Causal Inference
All simulators

Conditional Expectation & Total Variance

Two groups, their means and spreads: split total variance into within and between parts.

Day 6: Conditional Expectation, the LIE & Total Variance
00.010.020.030255075100125wage ($ thousands)densityE[W|HS]E[W|Col]E[W]
high school (weighted by share)college (weighted by share)all workers
Var(W) = E[Var(W|X)] + Var(E[W|X])
within 220
between 216
E[W] (LIE)
52.0
Var(W)
436
Share explained (R²)
0.50
between ÷ total
Within-group share
0.50

The overall distribution (grey) is a mixture of the two groups. Its mean is the share-weighted average of group means (LIE); its variance is within + between.