= Conditional variance
{title2=$\operatorname{Var}(X\mid\mathcal G)$}
{wiki}
The conditional variance measures the remaining squared uncertainty after specified information has been used to form a <conditional mean>. For a real <square-integrable> <random variable> $X$ and a sub-<sigma-algebra> $\mathcal G$, let $m=\mathbb E[X\mid\mathcal G]$. Then
$$
\operatorname{Var}(X\mid\mathcal G)
=\mathbb E[(X-m)^2\mid\mathcal G]
=\mathbb E[X^2\mid\mathcal G]-m^2.
$$
It is a $\mathcal G$-measurable <random variable>, nonnegative <almost surely>, rather than necessarily a single number. With the information $\mathcal G=\sigma(Y)$, its value is the <variance> in the group identified by $Y$. Its <expected value> is the <mean squared error> of predicting $X$ by its <conditional mean>.<Probability: Theory and Examples (fifth edition) by Rick Durrett/4.1 Conditional Expectation>[Theorem 4.1.15, p. 213]{ref}
In the exact <mixture distribution> in <law of total expectation>, group $A$ contains $0,4$ around mean two, and group $B$ contains $6,10$ around mean eight. Both groups have <conditional variance> four because their deviations from their own means are $-2,2$ with equal probabilities. Therefore $\mathbb E[\operatorname{Var}(X\mid Y)]=4$. Meanwhile, the two group means have <variance> $\frac14(2-13/2)^2+\frac34(8-13/2)^2=27/4$. The <law of total variance> gives
$$
\boxed{\operatorname{Var}(X)=4+\frac{27}{4}=\frac{43}{4}.}
$$
Direct calculation gives $\mathbb E[X^2]=53$ and $\operatorname{Var}(X)=53-(13/2)^2=43/4$, checking the decomposition.
\Image[/conditional-variance-within-between-groups.png]
{title=Total variance separates remaining within-group error from variation of group means}
{description=Left: in the stipulated finite <mixture distribution>, each group's values deviate by $\pm2$ from its <conditional mean>. Right: the total <variance> $43/4$ separates into expected <conditional variance> four and <variance> of the <conditional mean> $27/4$. Knowing the group removes the latter part from the average squared prediction error. Values and weights are exact model choices, not measured data.}
For any square-integrable $\mathcal G$-measurable predictor $Z$, the error identity is
$$
\mathbb E[(X-Z)^2]=\mathbb E[\operatorname{Var}(X\mid\mathcal G)]+\mathbb E[(m-Z)^2].
$$
The cross term vanishes because $\mathbb E[X-m\mid\mathcal G]=0$. Thus using the <conditional mean> minimizes <mean squared error>, while <conditional variance> quantifies what this information still cannot predict. This is the <orthogonal projection> interpretation in <L2 space>.<Probability: Theory and Examples (fifth edition) by Rick Durrett/4.1 Conditional Expectation>{ref}
Back to article page