The law of total variance is a fundamental result in probability theory that expresses the variance of a random variable in terms of its conditional variances and conditional means given another random variable . Informally, it states that the overall variability of can be split into an âÂÂunexplainedâ component (the average of within-group variances) and an âÂÂexplainedâ component (the variance of group means).
Formally, if and are random variables on the same probability space, and has finite variance, then:
This identity is also known as the variance decomposition formula, the conditional variance formula, the law of iterated variances, or colloquially as EveâÂÂs law, in parallel to the âÂÂAdamâÂÂs lawâ naming for the law of total expectation.
In actuarial science (particularly in credibility theory), the two terms and are called the expected value of the process variance (EVPV) and the variance of the hypothetical means (VHM) respectively.
Let be a random variable and another random variable on the same probability space. The law of total variance can be understood by noting:
Adding these components yields the total variance , mirroring how analysis of variance partitions variation.
Suppose five students take an exam scored 0âÂÂ100. Let = studentâÂÂs score and indicate whether the student is *international* or *domestic*:
Both groups share the same mean (50), so the explained variance is 0, and the total variance equals the average of the within-group variances (weighted by group size), i.e. 800.
Let be a coin flip taking values with probability and with probability . Given Heads, ; given Tails, . Then
so
Consider a two-stage experiment:
Then The overall variance of becomes
with uniform on
Let , , be observed pairs. Define Then
where Expanding the square and noting the cross term cancels in summation yields:
Using and the law of total expectation:
Subtract and regroup to arrive at
In a one-way analysis of variance, the total sum of squares (proportional to ) is split into a âÂÂbetween-groupâ sum of squares () plus a âÂÂwithin-groupâ sum of squares (). The F-test examines whether the explained component is sufficiently large to indicate has a significant effect on .
In linear regression and related models, if the fraction of variance explained is
In the simple linear case (one predictor), also equals the square of the Pearson correlation coefficient between and .
In many Bayesian and ensemble methods, one decomposes prediction uncertainty via the law of total variance. For a Bayesian neural network with random parameters :
often referred to as âÂÂaleatoricâ (within-model) vs. âÂÂepistemicâ (between-model) uncertainty.
Credibility theory uses the same partitioning: the expected value of process variance (EVPV), and the variance of hypothetical means (VHM), The ratio of explained to total variance determines how much âÂÂcredibilityâ to give to individual risk classifications.
For jointly Gaussian , the fraction relates directly to the mutual information In non-Gaussian settings, a high explained-variance ratio still indicates significant information about contained in .
The law of total variance generalizes to multiple or nested conditionings. For example, with two conditioning variables and :
More generally, the law of total cumulance extends this approach to higher moments.