Skip to content
Glacius
ProbabilityConcept reference

Total variance

Overall variance includes spread inside each case and differences between case means.

On this page 7 sections
  1. Overview
  2. Variability within and between cases
  3. Compute both parts
  4. Split a deviation at its group mean
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01Variability within and between cases#

Overall variance includes spread inside each case and differences between case means. The law of total variance accounts for both:

Var(X)=E[Var(XY)]+Var(E[XY])\begin{gathered}\operatorname{Var}(X)\\=E[\operatorname{Var}(X\mid Y)]\\+\operatorname{Var}(E[X\mid Y])\end{gathered}

The first term is the probability-weighted average of conditional variances. The second treats the conditional means as values of a new random variable and computes their variance.

02Compute both parts#

Suppose cases a,ba,b are equally likely, have means 1,51,5, and variances 2,62,6. The within-case term is (2+6)/2=4(2+6)/2=4. The overall mean is (1+5)/2=3(1+5)/2=3.

The case means deviate from 33 by 2-2 and 22, so the between-case variance is 44. Adding gives total variance 88. Averaging the conditional variances alone would miss half the variability.

Check your reasoning

Two equally likely cases have means 0,4 and variances 1,3. Find total variance.

  1. A6
  2. B2
  3. C4
Show answer and explanation
6

Within variance is 2; means have overall center 2 and variance 4.

03Split a deviation at its group mean#

Write XE[X]X-E[X] as the sum of XE[XY]X-E[X\mid Y] and E[XY]E[X]E[X\mid Y]-E[X]. The first piece fluctuates within a case; the second shifts the case mean relative to the overall mean.

After squaring, the cross term has expectation zero: within each case, the first piece averages to zero. The two remaining squared terms produce the stated decomposition. Finite variances are assumed.

Check your reasoning

A draft averages conditional variances and calls the result total variance, despite different case means. What is missing?

  1. ASquare of the overall mean
  2. BVariance of the conditional means
  3. CSum of the conditional means
Show answer and explanation
Variance of the conditional means

The omitted term measures between-case variability.

If case means coincide, the between-case term is zero. If each case is internally constant, the within-case term is zero, yet the overall variance can remain positive. This distinction is useful when interpreting heterogeneous datasets.

Key takeaway

Decompose variance into within-case and between-case components.

  • Decompose variance into within-case and between-case components.

Sources & further reading

  1. [1]
  2. [2]
    Harvard Stat 110, Strategic Practice 10 (2011)stat110.hsites.harvard.edu · Article
  3. [3]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Total variance.” Math behind ML. /learn/p-total-variance