The law of total probability finds a probability by splitting into cases. The same idea works for averages: find the average within each case, then average those, weighting each case by its probability. Within a case the average comes from the conditional distribution.
Key idea
Why it works
| $X = 0$ | $X = 1$ | $X = 2$ | $P(Y = y)$ | |
|---|---|---|---|---|
| $Y = 0$ | $\frac{1}{6}$ | $\frac{1}{6}$ | $0$ | $\frac{1}{3}$ |
| $Y = 1$ | $\frac{1}{12}$ | $\frac{1}{4}$ | $\frac{1}{3}$ | $\frac{2}{3}$ |
| $P(X = x)$ | $\frac{1}{4}$ | $\frac{5}{12}$ | $\frac{1}{3}$ | $1$ |
Worked examples
Worked example: Slice means from a table
- Given $Y = 0$: probabilities $\frac{1}{2}, \frac{1}{2}, 0$, so $E[X \mid Y = 0] = \frac{1}{2}$.
- Given $Y = 1$: probabilities $\frac{1}{8}, \frac{3}{8}, \frac{1}{2}$, so $E[X \mid Y = 1] = \frac{3}{8} + 1 = \frac{11}{8}$.
- $$E[X] = \frac{1}{3} \cdot \frac{1}{2} + \frac{2}{3} \cdot \frac{11}{8} = \frac{1}{6} + \frac{11}{12} = \frac{13}{12}$$ matching the marginal calculation.
Answer: $\frac{1}{2}$, $\frac{11}{8}$ and $\frac{13}{12}$
Worked example: A two-stage experiment
- Given $N = n$, the heads are binomial with mean $\frac{n}{2}$: $E[X \mid N] = \frac{N}{2}$.
- $E[X] = E\left[\frac{N}{2}\right] = \frac{1}{2} \cdot \frac{7}{2} = \frac{7}{4}$.
Answer: $\frac{7}{4}$
Worked example: Group averages
- $$E[X] = 0.5(30) + 0.3(40) + 0.2(60) = 15 + 12 + 12 = 39$$ minutes.
- The plain average of the three means, about 43.3, is wrong: group 3 is small.
Answer: 39 minutes
Common mistake