Tutorials › Multiple Imputation by Chained Equations (MICE) › The Law of Total Variance in Regression Imputation

Why Single Imputation Fails · Tutorial 44 of 497

The Law of Total Variance in Regression Imputation

Use the law of total variance to show exactly which component of outcome variation deterministic regression imputation removes, and when the loss depends on the missingness pattern.

Beginner 10 min read

What You'll Learn

  • State the law of total variance for an outcome conditional on predictors.
  • Separate between-predictor variation from within-predictor residual variation.
  • Derive the completed-data variance under deterministic regression imputation.
  • Calculate omitted variance under MCAR and predictor-dependent missingness.
  • Identify the assumptions and diagnostics relevant to this variance comparison.
  • Distinguish a variance identity from a finite-sample guarantee.

Why Conditional Means Do Not Preserve Total Variation

Regression uses predictors to estimate an outcome’s conditional mean. When an outcome is missing, deterministic regression imputation fills it with that predicted mean. This can preserve differences between cases with different predictor values, but it assigns no residual deviation to an imputed case. The law of total variance makes this distinction precise: total outcome variation includes both variation in conditional means across predictor values and variation around those means within predictor values.

The result below concerns the outcome distribution in a target population, or an idealized completed cohort, rather than an exact formula for every finite-sample variance calculated with a particular denominator. It assumes that the conditional mean model is correct and that missingness does not reveal additional information about the outcome after conditioning on the predictors.

Definition: Let \(Y\) be an outcome and \(X\) the predictor information used in the imputation model. If \(Y\) has a finite variance, the law of total variance states $$ \operatorname{Var}(Y) = \operatorname{Var}\!\left(\operatorname{E}[Y\mid X]\right) + \operatorname{E}\!\left[\operatorname{Var}(Y\mid X)\right]. $$ The first term is the variance of the conditional means across predictor values. The second is the average conditional variance: the variation in \(Y\) that remains among cases with the same \(X\).

Write \(m(X)=\operatorname{E}[Y\mid X]\), and define the residual \(\varepsilon=Y-m(X)\). Then \(\operatorname{E}[\varepsilon\mid X]=0\), and \(\operatorname{Var}(Y\mid X)=\operatorname{Var}(\varepsilon\mid X)\). The identity becomes $$ \operatorname{Var}(Y) = \operatorname{Var}(m(X)) + \operatorname{E}\!\left[\operatorname{Var}(\varepsilon\mid X)\right]. $$

A deterministic conditional-mean prediction is \(m(X)\), not \(m(X)+\varepsilon\). Thus the spread of predictions across cases reflects the first component, while the predictions contain none of the second component as variation among imputed outcomes at the same predictor value. This does not mean the residual variation is unimportant or that it is always constant: it may differ across predictor values.

Deriving the Variance of a Deterministically Completed Outcome

Let \(R=1\) indicate that \(Y\) is observed and \(R=0\) indicate that it is missing. In this tutorial, imagine filling each missing outcome with the true conditional mean \(m(X)\), as if the model were known. The completed outcome is $$ Y_c=RY+(1-R)m(X). $$ Since \(Y=m(X)+\varepsilon\), this can also be written \(Y_c=m(X)+R\varepsilon\). The latter form shows that an observed outcome retains its residual, while a missing outcome receives no residual.

For the following variance calculation, assume that the conditional mean \(m(X)\) is correctly specified; \(X\) is available for cases with missing outcomes; and, conditional on \(X\), the observation indicator \(R\) is independent of the outcome residual. The last condition is a MAR-type condition for this outcome model: after conditioning on \(X\), observation status does not select cases according to their unobserved residual. Assume also finite second moments. Write \(r(X)=P(R=1\mid X)\).

Result: Under these assumptions, the variance of the completed outcome is $$ \operatorname{Var}(Y_c) = \operatorname{Var}(m(X)) + \operatorname{E}\!\left[r(X)\operatorname{Var}(\varepsilon\mid X)\right]. $$ The full outcome variance is \(\operatorname{Var}(m(X))+\operatorname{E}[\operatorname{Var}(\varepsilon\mid X)]\). Therefore, the reduction in variance is $$ \operatorname{Var}(Y)-\operatorname{Var}(Y_c) = \operatorname{E}\!\left[(1-r(X))\operatorname{Var}(\varepsilon\mid X)\right]. $$

Here the comparison is for the same target distribution of \(X\), with observed outcomes retaining their actual residuals and missing outcomes replaced by conditional means. It is not a claim that an estimated sample variance must equal these population expressions exactly.

A Short Derivation

Condition on \(X\). Because \(R\) is conditionally independent of \(\varepsilon\), and \(\operatorname{E}[\varepsilon\mid X]=0\), the completed outcome has conditional mean \(m(X)\). Its conditional variance is the variance of \(R\varepsilon\): $$ \operatorname{E}[Y_c\mid X]=m(X),\qquad \operatorname{Var}(Y_c\mid X)=\operatorname{Var}(R\varepsilon\mid X). $$

Since \(R\) is either zero or one, \(R^2=R\). Also, \(\operatorname{E}[R\varepsilon\mid X]=0\). Thus $$ \operatorname{Var}(R\varepsilon\mid X) = \operatorname{E}[R^2\varepsilon^2\mid X] = r(X)\operatorname{E}[\varepsilon^2\mid X] = r(X)\operatorname{Var}(\varepsilon\mid X). $$

Applying the law of total variance to \(Y_c\) gives the stated completed-data formula. Applying it to \(Y\) gives the full outcome variance. Subtracting the two expressions yields the omitted component: $$ \operatorname{Var}(Y)-\operatorname{Var}(Y_c) = \operatorname{E}[\operatorname{Var}(\varepsilon\mid X)] - \operatorname{E}[r(X)\operatorname{Var}(\varepsilon\mid X)] = \operatorname{E}[(1-r(X))\operatorname{Var}(\varepsilon\mid X)]. $$

The result is nonnegative because \(0\leq r(X)\leq 1\) and conditional variances are nonnegative. It is zero only when there is no missingness at predictor values with residual variation, or when the conditional residual variance is zero there. In the common special case of MCAR with missing fraction \(q\), \(r(X)=1-q\) for every \(X\). The reduction is then \(q\operatorname{E}[\operatorname{Var}(\varepsilon\mid X)]\). With predictor-dependent missingness, the amount lost depends on where missingness occurs as well as on the conditional residual variance there.

Worked Examples

Worked Example: Two Predictor Groups and the Missing Within-Group Component

Suppose a hypothetical population has two equally common predictor groups. The conditional mean outcome is 10 units in group A and 14 units in group B. In both groups, the conditional residual variance is 9 square units. Find the full outcome variance and the variance of the deterministic predictions.

The overall mean of the conditional means is \((10+14)/2=12\) units. Their variance is $$ \operatorname{Var}(m(X)) = \frac{(10-12)^2+(14-12)^2}{2} = \frac{4+4}{2} = 4\ \text{square units}. $$

The average conditional residual variance is 9 square units. Therefore the law of total variance gives $$ \operatorname{Var}(Y)=4+9=13\ \text{square units}. $$

A deterministic prediction takes only the values 10 and 14 in this setup, so its variance is 4 square units. The difference, \(13-4=9\) square units, is exactly the within-group residual component. The prediction captures the variation between the two group means, but not outcome variation among people in either group.

Worked Example: MCAR Missingness Reduces Residual Contribution

Continue with the hypothetical population above. Suppose 40% of outcomes are missing completely at random, so \(q=0.40\) and \(r(X)=0.60\) in both groups. Assume observed outcomes retain their actual residuals and missing outcomes are filled with the correct group mean. Calculate the completed-data variance.

The between-group component remains 4 square units. The residual component retained in the completed data is $$ \operatorname{E}[r(X)\operatorname{Var}(\varepsilon\mid X)] = 0.60(9) = 5.4\ \text{square units}. $$

Thus $$ \operatorname{Var}(Y_c)=4+5.4=9.4\ \text{square units}. $$

The full variance was 13 square units, so the reduction is \(13-9.4=3.6\) square units. The same result follows from the omitted-component formula: \(q(9)=0.40(9)=3.6\) square units. The 40% missing fraction does not remove 40% of the total variance here; it removes 40% of the residual component, which is \(9/13\) of the total.

Worked Example: Missingness and Residual Spread Both Vary by Predictor Group

Consider a different hypothetical population with two equally common predictor groups. Their conditional means are 10 and 14 units. Their conditional residual variances are 4 and 16 square units, respectively. In group 1, 20% of outcomes are missing; in group 2, 50% are missing. Assume missingness is independent of the outcome conditional on group. Find the full variance, completed variance, and reduction.

The conditional means have variance $$ \operatorname{Var}(m(X)) = \frac{(10-12)^2+(14-12)^2}{2} = 4\ \text{square units}. $$

The average residual variance is \(\{4+16\}/2=10\) square units, so the full outcome variance is \(4+10=14\) square units. The observation probabilities are \(r_1=0.80\) and \(r_2=0.50\). The residual variance retained is $$ \operatorname{E}[r(X)\operatorname{Var}(\varepsilon\mid X)] = \frac{0.80(4)+0.50(16)}{2} = \frac{3.2+8}{2} = 5.6\ \text{square units}. $$

Consequently, \(\operatorname{Var}(Y_c)=4+5.6=9.6\) square units, and the reduction is \(14-9.6=4.4\) square units. Directly, the omitted residual component is $$ \frac{0.20(4)+0.50(16)}{2} = \frac{0.8+8}{2} = 4.4\ \text{square units}. $$

Although the groups are equally common, most of the reduction comes from group 2: it has both a larger residual variance and a larger missing fraction. A single overall missing percentage would not describe this pattern adequately.

Assumptions, Diagnostics, and Limits

The derivation identifies a specific variance component; it does not guarantee that a fitted regression model represents the data well. In practice, \(m(X)\) is estimated from observed cases. The formulas treat it as the correct conditional mean and set aside estimation error. They also presume that the predictor values needed for imputation are observed and that conditioning on the included predictors makes observation status independent of the outcome residual.

Several checks help assess whether the variance comparison is a useful description:

The law of total variance itself does not require a normal outcome distribution. Nor does it require homoscedastic residuals. It requires finite second moments, while the imputation-specific result additionally relies on the stated conditional mean and missingness assumptions. If these assumptions fail, deterministic predictions may omit residual variation and also misrepresent the conditional mean or the distribution of cases being imputed.

Mean imputation is a limiting comparison in which the same overall mean is assigned regardless of predictors, so it does not preserve between-predictor variation in the same way. Complete-case analysis avoids assigning predictions but changes which cases contribute to the analysis and can target a different distribution. Methods that add residual variation to predictions address the missing within-predictor component differently; their properties require separate assumptions and are not established merely by this variance identity.

Common Mistake

A frequent error is to say, “Regression imputation preserves the variance because the predictions differ across people.” That reasoning counts only variation in predicted means. The law of total variance shows that the outcome also varies around those means: \(\operatorname{E}[\operatorname{Var}(Y\mid X)]\). Deterministic predictions for missing outcomes have no such within-predictor residual deviations. The correction is to distinguish the variance of predictions from the full outcome variance, and to account for how many outcomes are missing at predictor values with residual spread.

Key takeaway: Under a correct conditional mean model and MAR given its predictors, deterministic regression imputation retains residual variation only for observed outcomes. The omitted variance is the average conditional residual variance weighted by the probability that an outcome is missing.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. If \(\operatorname{Var}(m(X))=5\) and \(\operatorname{E}[\operatorname{Var}(Y\mid X)]=7\), what is \(\operatorname{Var}(Y)\)?
  2. Under MCAR, 25% of outcomes are missing and the average conditional residual variance is 12 square units. How much variance is omitted by deterministic imputation?
  3. Why can predictions have substantial variance while deterministic imputation still reduce the outcome variance?
  4. In two equally common groups, residual variances are 2 and 10 square units, while missing fractions are 10% and 60%. Calculate the omitted variance.

Solutions. (1) By the law of total variance, \(\operatorname{Var}(Y)=5+7=12\). (2) Under MCAR the omitted component is \(q\operatorname{E}[\operatorname{Var}(Y\mid X)]=0.25(12)=3\) square units. (3) Prediction variance represents differences in conditional means across \(X\); deterministic imputation contributes no residual deviations for the missing outcomes, so the within-\(X\) component is reduced. (4) The omitted variance is the average of the group-specific missing fractions times their residual variances: \(\{0.10(2)+0.60(10)\}/2=(0.2+6)/2=3.1\) square units.

Back to Tutorials
Clinical Biostats