The Law of Total Variance
Why a portfolio's overall risk splits cleanly into "risk within each regime" plus "risk from switching between regimes" — the identity behind regime-based risk models and hierarchical forecasting.
Prerequisites: Independence and Product Measures
Total portfolio variance seems like it should come purely from day-to-day price wiggles. But regimes matter too — a strategy might be calm within any given market regime (say, low-vol vs high-vol) yet still show large overall variance simply because it behaves very differently across regimes. The law of total variance is the exact identity that splits total variance into these two separate sources, and it is the reason "average within-group variance" is never the whole risk story.
The analogy: variance within classrooms versus variance between classrooms
Imagine measuring the height of every student in a school, split across ten classrooms. Some spread comes from ordinary kid-to-kid variation within any one classroom. But some spread also comes from the fact that a fifth-grade classroom's average height is simply different from a first-grade classroom's average height — spread between classroom averages. Add a student's classroom-level average height back to the picture, and total height variance in the whole school splits cleanly into "how much kids vary around their own classroom's average" plus "how much classroom averages vary from each other." Neither piece alone tells the whole story; you need both.
Writing it down
Let be the quantity you care about (say, a strategy's daily return) and the "grouping" variable (say, which volatility regime today falls into). The law of total variance says
Read the two terms in words. The first term, , is the average within-group variance: for each fixed regime , compute how much wiggles inside that regime, then average that wiggle across regimes, weighted by how likely each regime is. The second term, , is the variance of the group means: compute each regime's average return, then measure how much those regime-averages themselves spread out. Total variance is the sum of "typical spread inside a group" and "spread of the group centers" — nothing is double-counted, and nothing is left out.
Worked example 1: two regimes, computed by hand
Suppose daily returns come from two regimes, each equally likely (). In "calm," returns average with variance (in %² units). In "stormy," returns average with variance . Compute the two pieces.
Within-group term: .
Between-group term: first find the overall mean, . The group means are and ; their variance around the overall mean is .
Total: . Check it directly by computing from the full mixture — a two-point mixture of normals with those means and variances gives exactly by the same decomposition, confirming the identity holds exactly, not approximately.
Worked example 2: why ignoring the between term understates risk
A risk manager estimates "typical" daily variance by averaging each regime's variance, getting from example 1, and reports that as the portfolio's variance. The true total variance is — a 20% underestimate. The missing is entirely due to regime-switching risk: even if each regime were perfectly calm internally, the fact that the mean return jumps between and as regimes change is itself a source of variance that a within-group-only estimate silently drops. Doubling the mean gap — say calm at and stormy at instead of — would quadruple the between-group term to , since it is a squared distance, while leaving the within-group term at unchanged, so total variance would jump to .
What this means in practice
Regime-switching risk models, hierarchical Bayesian forecasts, and factor models that pool data across sectors or time periods all rely on this decomposition to separate "noise within a bucket" from "risk from which bucket you're in." A model that only estimates within-group variance — common when volatility is calibrated separately per regime without accounting for how regimes themselves shift — systematically understates total risk, exactly as in worked example 2.
Total variance always equals average within-group variance plus the variance of the group means: . Both pieces are needed; neither one alone equals total variance.
The classic mistake is estimating risk purely from within-group variance — computing volatility separately inside each known regime and stopping there — while ignoring that the regime means themselves differ. This silently drops the between-group term, which can be a large share of total variance, as worked example 2 shows. Any time a model conditions on a regime, sector, or time bucket, check whether the conditioning variable's own mean shifts meaningfully — if it does, the "average within-group variance" is understating true risk.
Related concepts
Practice in interviews
Further reading
- Casella & Berger, Statistical Inference (ch. 4.4)
- Blitzstein & Hwang, Introduction to Probability (ch. 9)