Simple Algorithm
Machine Learning · Convergence · 26 min

Missing Data

MCAR, MAR, MNAR and principled imputation.

A missing value is not just a hole to fill: the reason it is missing can carry as much information as the value would have. This lesson formalizes Rubin's missingness mechanisms, proves when the mechanism can be ignored, shows why filling in single values understates uncertainty and how multiple imputation and EM repair it, confronts data missing not at random with sensitivity analysis, and then turns to prediction, where the rules change.

What you’ll learn

  • Define MCAR, MAR and MNAR through the distribution of the missingness indicators, and prove Rubin's ignorability theorem for likelihood inference.
  • Show when complete-case analysis is unbiased, and how mean, regression and stochastic imputation distort variances, correlations and standard errors.
  • Derive Rubin's rules for combining multiple imputations, and the E-step of EM for a bivariate normal with missing values.
  • Explain why data missing not at random need untestable assumptions, and run a δ\delta-adjustment sensitivity analysis.
  • State what is known about prediction with missing values: pattern-wise Bayes predictors, consistency of impute-then-regress, missingness indicators and trees.

Mechanisms and ignorability

MechanismExampleWhat it implies
MCARblood samples lost at random in transitcomplete cases are a random subsample: unbiased, just smaller
MARolder patients skip a questionnaire item more often, and age is recordedthe observed data, used properly (likelihood, multiple imputation), can correct the bias
MNARpeople with high incomes decline to report income; a sensor saturates above its rangenothing in the observed data reveals the bias: assumptions are unavoidable
DerivationProof
  1. f(Yobs,M∣θ,ϕ)=∫f(Yobs,Ymis∣θ) f(M∣Yobs,Ymis,ϕ) dYmisf(Y_{\text{obs}},M\mid\theta,\phi)=\int f(Y_{\text{obs}},Y_{\text{mis}}\mid\theta)\,f(M\mid Y_{\text{obs}},Y_{\text{mis}},\phi)\,dY_{\text{mis}}

    The observed data are YobsY_{\text{obs}} and MM. Their likelihood integrates the unobserved values out of the full model:

  2. =f(M∣Yobs,ϕ)∫f(Yobs,Ymis∣θ) dYmis=f(M∣Yobs,ϕ) f(Yobs∣θ)=f(M\mid Y_{\text{obs}},\phi)\int f(Y_{\text{obs}},Y_{\text{mis}}\mid\theta)\,dY_{\text{mis}}=f(M\mid Y_{\text{obs}},\phi)\,f(Y_{\text{obs}}\mid\theta)

    Under MAR the second factor does not depend on YmisY_{\text{mis}}, so it leaves the integral:

  3. L(θ,ϕ∣Yobs,M) ∝ L(θ∣Yobs)⋅L(ϕ∣Yobs,M)L(\theta,\phi\mid Y_{\text{obs}},M)\ \propto\ L(\theta\mid Y_{\text{obs}})\cdot L(\phi\mid Y_{\text{obs}},M)

    The likelihood factorizes into a part with θ\theta alone and a part with ϕ\phi alone. With distinct parameters, maximizing over θ\theta, or forming its posterior, never involves the second factor.

Two caveats. First, MAR cannot be tested from the observed data: Molenberghs, Beunckens, Sotto & Kenward (2008) showed that every MNAR model has an MAR counterpart that fits the observed data exactly as well. MAR is an assumption justified by knowing how the data were collected, and made more plausible by recording the variables that drive missingness.

Second, the definition comes in versions. Seaman, Galati, Jackson & Carlin (2013) distinguish realized MAR, holding at the data actually observed, from everywhere MAR, holding for every possible dataset. Realized MAR suffices for direct-likelihood and Bayesian inference to ignore the mechanism; frequentist guarantees over repeated samples, such as standard errors from the observed information, need everywhere MAR (and the expected information is safe only under everywhere MCAR).

Check your understanding

In a clinical study, patients with more severe symptoms at baseline are more likely to drop out before the final measurement. Severity is recorded at baseline, and once it is known, the final outcome itself does not affect dropout. Which mechanism describes the missing final outcomes?

  1. MCAR, because dropout is a random event
  2. MAR, because dropout depends only on the observed baseline severity
  3. MNAR, because sicker patients drop out
  4. None: dropouts must be removed from the study
Show the answer

B. MAR, because dropout depends only on the observed baseline severity

Missingness depends on an observed variable, baseline severity, and not on the unobserved outcome given that variable: the definition of MAR. Complete cases are biased toward milder patients, but a likelihood or multiple-imputation analysis that conditions on severity can correct it.

Complete cases and single imputation

Dropping incomplete rows is unbiased under MCAR. It can also be unbiased for a regression in a surprisingly broad case: whenever missingness is independent of the outcome given the covariates, even if it depends on the covariates, and even if a covariate is MNAR.

DerivationWhen complete cases give the right regression
  1. f(y∣x,R=1)=P(R=1∣x,y) f(y∣x)P(R=1∣x)f(y\mid x,R=1)=\frac{P(R=1\mid x,y)\,f(y\mid x)}{P(R=1\mid x)}

    Let R=1R=1 mark complete rows. The regression a complete-case analysis estimates is the conditional distribution of YY given XX among those rows. By Bayes' rule:

  2. f(y∣x,R=1)=f(y∣x)f(y\mid x,R=1)=f(y\mid x)

    If R⊥ ⁣ ⁣ ⁣⊥Y∣XR\indep Y\mid X, then P(R=1∣x,y)=P(R=1∣x)P(R=1\mid x,y)=P(R=1\mid x), and the selection cancels:

  3. P(R=1∣x,y)≠P(R=1∣x)⟹f(y∣x,R=1)≠f(y∣x) in generalP(R=1\mid x,y)\ne P(R=1\mid x)\quad\Longrightarrow\quad f(y\mid x,R=1)\ne f(y\mid x)\ \text{in general}

    So a correctly specified regression fitted to complete cases is consistent, at the cost of lost data. If missingness depends on YY given XX, as when people drop out because of the outcome, the selection factor stays and the complete-case regression is biased. Means and marginal distributions of XX are another matter: under MAR they are biased whenever missingness depends on the covariates.

Single imputationFills a gap withDistortion
Mean or medianone constant per featurevariance shrinks by 1−m1-m, correlations by 1−m\sqrt{1-m} (MCAR, fraction mm missing)
Regressionthe prediction from the other featuresimputed points lie on the regression surface, so correlations are inflated: with correlation 0.5 and 36% missing completely at random, 0.5/0.64+0.36⋅0.25≈0.5850.5/\sqrt{0.64+0.36\cdot0.25}\approx0.585
Stochastic regressionthe prediction plus a random residualpreserves the joint distribution under MAR if the model is right; standard errors still too small
Hot deck, kk-NNa value from a similar complete rowplausible values; same understatement of uncertainty
Constant plus a missingness flaga constant, and a 0/1 indicator featurefor estimating regression coefficients generally biased, even under MCAR, when features are correlated; often helpful for prediction (step 5)
The shared flaw: a completed dataset is analyzed as if every value had been observed, so the uncertainty about the imputed values disappears from standard errors and confidence intervals, which come out too narrow.

Multiple imputation, chained equations and EM

Multiple imputation (Rubin, 1987) draws DD completed datasets from the predictive distribution of the missing values given the observed ones, including the uncertainty about the imputation model's parameters ("proper" imputation). Each dataset is analyzed with ordinary complete-data methods, giving an estimate Q^k\hat Q_k and its squared standard error UkU_k (k=1,…,Dk=1,\dots,D), and the results are pooled with Rubin's rules:

Qˉ=1D∑kQ^k,Uˉ=1D∑kUk,B=1D−1∑k(Q^k−Qˉ)2,T=Uˉ+(1+1D)B\bar Q=\frac1D\sum_k\hat Q_k,\qquad\bar U=\frac1D\sum_kU_k,\qquad B=\frac1{D-1}\sum_k(\hat Q_k-\bar Q)^2,\qquad T=\bar U+\Big(1+\frac1D\Big)B
Intervals use a tt distribution with ν=(D−1)(1+Uˉ/((1+1/D)B))2\nu=(D-1)\big(1+\bar U/((1+1/D)B)\big)^2 degrees of freedom, with a small-sample refinement by Barnard & Rubin (1999). The share of the variance due to missingness, (1+1/D)B/T(1+1/D)B/T, approximates the fraction of missing information. (Here DD counts imputations, since MM already names the missingness indicators.)
DerivationWhy the variances add
  1. Var⁡(Q∣Yobs)=E[Var⁡(Q∣Yobs,Ymis)]⏟within: estimated by Uˉ+Var⁡(E[Q∣Yobs,Ymis])⏟between: estimated by B\Var(Q\mid Y_{\text{obs}})=\underbrace{\E\big[\Var(Q\mid Y_{\text{obs}},Y_{\text{mis}})\big]}_{\text{within: estimated by }\bar U}+\underbrace{\Var\big(\E[Q\mid Y_{\text{obs}},Y_{\text{mis}}]\big)}_{\text{between: estimated by }B}

    Treat the quantity of interest QQ from a Bayesian point of view. By the law of total variance over the unknown YmisY_{\text{mis}}, its posterior variance has two parts:

  2. T=Uˉ+B+BD=Uˉ+(1+1D)BT=\bar U+B+\frac BD=\bar U+\Big(1+\frac1D\Big)B

    The within part is the uncertainty you would have with complete data; the between part is the extra uncertainty from not knowing the missing values. Single imputation reports only the first. And Qˉ\bar Q averages only DD draws, which adds simulation variance B/DB/D:

Predict before you look

Five imputations give coefficient estimates 0.52, 0.61, 0.47, 0.58 and 0.55, each with standard error 0.05. What is the pooled standard error T\sqrt T?

Show the answer

0.078

Qˉ=0.546\bar Q=0.546, Uˉ=0.052=0.0025\bar U=0.05^2=0.0025, and the sample variance of the five estimates is B=0.00293B=0.00293. So T=0.0025+1.2×0.00293=0.00602T=0.0025+1.2\times0.00293=0.00602 and T≈0.078\sqrt T\approx0.078, more than half as large again as the 0.05 that any single completed dataset reports. With ν≈11.7\nu\approx11.7 degrees of freedom the 95% interval is [0.377,0.715][0.377,0.715].

Chained equations. With many incomplete variables of mixed types, a joint model is hard to write down. MICE, multivariate imputation by chained equations (van Buuren & Groothuis-Oudshoorn, 2011), instead specifies one conditional model per variable (linear, logistic, ordinal...), and cycles: impute each variable from the current values of all the others, with parameters drawn from their posterior, for a number of iterations; repeat to get DD datasets. The conditionals need not be compatible with any joint distribution, so there is no general convergence guarantee, but the method works well in practice. The imputation model must be at least as rich as the analysis: leave the outcome out when imputing a covariate and its association with that covariate is biased toward zero, an instance of what Meng (1994) called uncongeniality.

EM (Dempster, Laird & Rubin, 1977) instead maximizes the observed-data likelihood directly, alternating between expected complete-data sufficient statistics and parameter updates; the likelihood never decreases (Why EM Works). For a bivariate normal with xx always observed and yy missing at random in some rows, the E-step shows exactly what regression imputation forgets:

DerivationEM for a bivariate normal with missing y
  1. y^i=E[yi∣xi]=μy+σxyσxx(xi−μx),σyy⋅x=σyy−σxy2σxx\hat y_i=\E[y_i\mid x_i]=\mu_y+\frac{\sigma_{xy}}{\sigma_{xx}}(x_i-\mu_x),\qquad\sigma_{yy\cdot x}=\sigma_{yy}-\frac{\sigma_{xy}^2}{\sigma_{xx}}

    E-step. For a row with yiy_i missing, the conditional distribution of yiy_i given xix_i under the current parameters is normal with mean y^i\hat y_i and residual variance σyy⋅x\sigma_{yy\cdot x}:

  2. E[yi∣xi]=y^i,E[yi2∣xi]=y^i2+σyy⋅x,E[xiyi∣xi]=xiy^i\E[y_i\mid x_i]=\hat y_i,\qquad\E[y_i^2\mid x_i]=\hat y_i^2+\sigma_{yy\cdot x},\qquad\E[x_iy_i\mid x_i]=x_i\hat y_i

    The sufficient statistics need E[yi2∣xi]\E[y_i^2\mid x_i], which is not y^i2\hat y_i^2: plugging in y^i\hat y_i, as regression imputation does, drops the conditional variance and understates σyy\sigma_{yy}:

  3. μy=1n∑iE[yi],σyy=1n∑iE[yi2]−μy2,σxy=1n∑iE[xiyi]−μxμy\mu_y=\frac1n\sum_i\E[y_i],\qquad\sigma_{yy}=\frac1n\sum_i\E[y_i^2]-\mu_y^2,\qquad\sigma_{xy}=\frac1n\sum_i\E[x_iy_i]-\mu_x\mu_y

    M-step. Recompute the means, variances and covariance from the completed sums. Iterate to convergence to the maximum-likelihood estimates under MAR.

Missing not at random

When missingness depends on the missing values themselves, the observed data cannot identify the answer without extra assumptions. Two families of models make the assumptions explicit:

  • Selection models factor f(Y) f(M∣Y)f(Y)\,f(M\mid Y): a model for the data and a model for who goes missing given the data. Heckman's (1979) model for sample selection is the classic example, with jointly normal errors in the outcome and selection equations; identification leans on that normality, ideally helped by a variable that affects selection but not the outcome.
  • Pattern-mixture models factor f(M) f(Y∣M)f(M)\,f(Y\mid M): a separate distribution of the data for each missingness pattern. The distribution of YY among non-responders is never observed, so it must be tied to the responders' by an assumption, which is exactly what makes the assumption easy to state and vary.

Because an MAR model always fits the observed data as well as any MNAR one, the honest output of an MNAR analysis is a sensitivity analysis: how the conclusion changes as the departure from MAR grows.

text
DELTA-ADJUSTMENT SENSITIVITY ANALYSIS (pattern-mixture)
  for delta in a grid of plausible departures (e.g. -20% ... +20% of the outcome's sd):
      impute the missing values D times under MAR
      shift every imputed value by delta              # non-responders differ by delta
      analyze each completed dataset; pool with Rubin's rules
      record the estimate and its interval
  report the curve of estimates against delta
  report the tipping point: the smallest |delta| that changes the conclusion

If the conclusion survives every δ\delta that experts find plausible, the MAR analysis can be trusted for this question; if a small δ\delta reverses it, the data cannot settle the question without better information about the non-responders.

Graphical models offer another route. Drawing the missingness indicators into a causal graph, an m-graph, Mohan & Pearl (2021) give conditions under which a quantity remains recoverable, that is consistently estimable, from the observed data, including under some MNAR mechanisms, and derive testable implications of missingness models. The answer depends on the query: a joint distribution may be unrecoverable while a particular conditional distribution is recoverable.

Think first A survey asks for household income, and high earners decline more often. A colleague proposes multiple imputation with age, region and occupation as predictors and reports the mean income with a confidence interval. What is missing from that analysis?

The MAR assumption, that nonresponse depends only on age, region and occupation, is doing all the work, and here it is doubtful: refusal depends on income itself. The imputations will be too low and the interval will not reflect that. Add a sensitivity analysis (for example, non-responders earn δ\delta% more than similar responders, over a range of δ\delta informed by external data such as tax statistics), and report how the mean moves. Collecting auxiliary variables that predict both income and refusal makes MAR more plausible, but nothing in the survey data alone can confirm it.

Prediction is different

Inference asks for unbiased parameters with honest uncertainty. Prediction asks for something else: a function that predicts well on new rows, which will have missing values too. With missingness pattern M=mM=\mathbf m and observed coordinates Xobs(m)X_{\text{obs}(\mathbf m)}, the Bayes-optimal predictor under squared loss is

f⋆(xobs,m)=E[Y∣Xobs(m)=xobs, M=m],f^\star(\mathbf x_{\text{obs}},\mathbf m)=\E\big[Y\mid X_{\text{obs}(\mathbf m)}=\mathbf x_{\text{obs}},\ M=\mathbf m\big],

a different regression for each of up to 2d2^d patterns. Two consequences stand out. MNAR is not an obstacle for prediction: if the mechanism is the same at training and at deployment, the fact that a value is missing is just more information. And imputation does not have to be accurate, only useful to the learner.

Trees can skip imputation altogether. Missing incorporated in attributes (MIA; Twala, Jones & Hand, 2008) lets each split also choose where the missing values go: left, right, or split "missing versus observed". XGBoost's sparsity-aware split finding learns a default direction for missing values at every node (Chen & Guestrin, 2016), and CART uses surrogate splits (CART in Depth). Josse et al. recommend MIA because it handles both informative and uninformative missingness. On eight health databases, Perez-Lebel, Varoquaux, Le Morvan, Josse & Poline (2022) found that native missing-value handling in gradient-boosted trees predicted at least as well as state-of-the-art imputation, at a fraction of the computational cost, and that when imputing, adding missingness indicators mattered, a sign that the values were not missing at random.

Key takeaways

  • MCAR, MAR and MNAR describe how missingness depends on the data. Under MAR with distinct parameters, likelihood and Bayesian inference may ignore the mechanism; MAR itself cannot be tested from the observed data.
  • Complete cases are unbiased under MCAR, and for regressions whenever missingness is independent of the outcome given the covariates. Every single imputation understates uncertainty.
  • Multiple imputation pools DD analyses with T=Uˉ+(1+1/D)BT=\bar U+(1+1/D)B; MICE builds the imputations variable by variable, and must include the outcome; EM needs the conditional variance that regression imputation drops.
  • MNAR requires assumptions the data cannot check: state them, and show how conclusions move with a sensitivity parameter.
  • For prediction the target is E[Y∣Xobs,M]\E[Y\mid X_{\text{obs}},M]: simple imputation plus a flexible learner can be consistent, missingness indicators help when missingness is informative, and trees can route missing values natively.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Under which conditions may likelihood-based inference about the data model ignore the missingness mechanism?

  1. Only if the data are MCAR
  2. Whenever fewer than 5% of values are missing
  3. If the data are MAR and the data-model and missingness-model parameters are distinct
  4. Always, since the likelihood uses only observed values
Show the answer

C. If the data are MAR and the data-model and missingness-model parameters are distinct

Under MAR the observed-data likelihood factorizes into a θ\theta part and a ϕ\phi part, and with distinct parameters the ϕ\phi part is irrelevant to inference about θ\theta (Rubin, 1976). MCAR is sufficient but not necessary.

Question 2

Four imputations give an average within-imputation variance Uˉ=0.04\bar U=0.04 and a between-imputation variance B=0.01B=0.01. What is the total variance TT?

  1. 0.04
  2. 0.0525
  3. 0.05
  4. 0.0625
Show the answer

B. 0.0525

T=Uˉ+(1+1/D)B=0.04+1.25×0.01=0.0525T=\bar U+(1+1/D)B=0.04+1.25\times0.01=0.0525 with D=4D=4. The between-imputation part carries the uncertainty about the missing values, inflated by 1/D1/D because only four draws were averaged.

Question 3

In which situation does complete-case analysis give an unbiased estimate of the regression of YY on XX (with a correct model)?

  1. When missingness depends on XX but not on YY given XX
  2. Only when data are MCAR
  3. When missingness depends on YY
  4. Never: deleting rows always biases a regression
Show the answer

A. When missingness depends on XX but not on YY given XX

If R⊥ ⁣ ⁣ ⁣⊥Y∣XR\indep Y\mid X, then f(y∣x,R=1)=f(y∣x)f(y\mid x,R=1)=f(y\mid x): selecting rows by their covariates does not distort the conditional distribution of the outcome. This holds even if the covariates themselves are MNAR. Selection that depends on YY given XX does distort it.

Further reading

  • D. B. Rubin, "Inference and missing data," Biometrika 63(3), 581–592 (1976).
  • D. B. Rubin, Multiple Imputation for Nonresponse in Surveys (Wiley, 1987).
  • R. J. A. Little & D. B. Rubin, Statistical Analysis with Missing Data, 3rd ed. (Wiley, 2019).
  • S. van Buuren & K. Groothuis-Oudshoorn, "mice: Multivariate Imputation by Chained Equations in R," Journal of Statistical Software 45(3), 1–67 (2011).
  • J. Josse, J. M. Chen, N. Prost, G. Varoquaux & E. Scornet, "On the consistency of supervised learning with missing values," Statistical Papers 65(9), 5447–5479 (2024).