Day 14. Missing Data & Inverse Probability Weighting
MCAR, MAR and MNAR; when complete-case analysis is biased; and how weighting repairs MAR.
- ●Classify a missing-data mechanism as MCAR, MAR or MNAR.
- ●Compute the bias of complete-case means and prove that IPW is unbiased under MAR.
- ●Combine multiply imputed estimates with Rubin's rules.
- ●Recognise causal inference as a missing-data problem for potential outcomes.
Theory
The response indicator
Let if is observed and if it is missing; is always observed. The mechanism is the distribution of given the data:
| Mechanism | Definition | Complete-case mean |
|---|---|---|
| MCAR (missing completely at random) | unbiased | |
| MAR (missing at random) | biased in general; fixable with | |
| MNAR (missing not at random) | depends on even given | biased; needs extra assumptions |
Inverse probability weighting (IPW)
Under MAR with response propensity , weighting each observed unit by rebuilds the full population:
Two sample versions:
The Hájek (normalised) version is usually more stable.
Multiple imputation and Rubin's rules
Impute the missing values times from a model, estimate (with variance ) in each completed data set, then combine:
The between-imputation part reflects uncertainty about the missing values themselves.
Causal inference is a missing-data problem
Each unit shows if treated and if not; the other is missing. Randomisation makes the missing potential outcome MCAR; unconfoundedness given makes it MAR; and IPW with the propensity score is exactly today's estimator, applied twice. Phase 3 builds on this.
Part 1 · Warm-up
Exercise 1 · Spot the mechanism (1)
A lab's freezer fails and destroys a random 10% of blood samples. Which mechanism?
Show solution
MCAR: missingness is unrelated to anything about the patients.
Exercise 2 · Spot the mechanism (2)
High earners are more likely to skip the income question, even among people with the same education and age. Which mechanism?
Show solution
MNAR: missingness depends on the missing value (income) itself, even after conditioning on observed covariates.
Exercise 3 · Spot the mechanism (3)
Older respondents are less likely to answer an online follow-up, but, within each age group, response is unrelated to the outcome. Which mechanism?
Show solution
MAR: missingness depends only on the observed covariate (age).
Exercise 4 · An IPW weight
A respondent's group has a response rate of 25%. What weight does each respondent get, and why?
Show solution
: each respondent stands in for themselves and three similar non-respondents.
Exercise 5 · Complete cases under MCAR
Why is the complete-case mean unbiased under MCAR? What is lost?
Show solution
Respondents are a random subsample, so their mean has the same expectation as the full-sample mean. The cost is precision: a smaller means a larger standard error.
Part 2 · Proofs
Exercise 6 · Complete-case mean under MCAR
Show that under MCAR.
Show solution
MCAR means is independent of , so (Day 6, Exercise 5).
Exercise 7 · IPW is unbiased under MAR
Prove when .
Show solution
Condition on and use the LIE:
The step is the MAR assumption, and (overlap) is needed to divide.
Exercise 8 · The bias under MNAR
Show that .
Show solution
Step 1. , so .
Step 2. Divide by .
Step 3. If response rises with , the covariance is positive and respondents overstate the mean.
Exercise 9 · Mean imputation understates variance
Fill missing values with the mean of the observed values. Show that the sample variance of the completed data is , where is the observed-data variance.
Show solution
Step 1. Imputed values equal the observed mean , so the completed-data mean is still , and they add zero to the sum of squares.
Step 2. That sum stays but is now divided by .
Step 3. With 30% missing, the variance shrinks by about 30% and standard errors are too small.
Exercise 10 · Rubin's rules
Five imputations give estimates 10.2, 9.8, 10.5, 10.0 and 9.5, each with within-imputation variance 0.25. Find the pooled estimate and its SE.
Show solution
. Deviations 0.2, −0.2, 0.5, 0, −0.5 give . Then
Part 3 · Applied
Exercise 11 · Bias from MNAR
30% of people are high earners () and 70% low earners (). High earners respond with probability 0.5, low earners with 0.9. Find the true mean and the respondents' mean.
Show solution
Step 1. True mean: .
Step 2. Share of the population who respond: high earners ; low earners ; total 0.78.
Step 3. Respondents' mean:
Answer: the survey reports 51.5 instead of 58, a bias of about −6.5, because high earners are under-represented among respondents.
Exercise 12 · Repairing MAR with weights
Half the sample is young (mean , response rate 0.4) and half old (mean , response rate 0.8); within age, response is random. Compare the complete-case mean with the IPW mean.
Show solution
Step 1. True mean: .
Step 2. Respondents: young , old (total 0.6).
Step 3. Complete-case mean: (old people over-represented).
Step 4. IPW weights: young , old . Weighted mean per person in the population:
Answer: complete cases give 33.3; IPW recovers the true 30.
Exercise 13 · Horvitz–Thompson versus Hájek in a household survey
Four sampled households have monthly food spending (in $10), where the fourth did not respond, so . Their estimated response probabilities are . Compute the Horvitz–Thompson and Hájek IPW estimates of mean spending.
Show solution
Step 1. Weighted values : , , , and 0. Sum: 97.5.
Step 2. Horvitz–Thompson divides by : .
Step 3. Hájek divides by the sum of the weights, : .
Answer: 24.4 versus 18.6 ($244 versus $186). In small samples they can differ a lot; the Hájek estimate always stays within the range of the observed values (here 10–30), so it is usually preferred.
Exercise 14 · Missing outcomes in regression
In a regression of wages on education, compare: (a) missingness that depends on education only; (b) missingness that depends on wages.
Show solution
(a) Missingness depends on education only
Step 1. Among people with the same education, respondents are a random subset, so .
Step 2. The regression line is unchanged; you lose precision and perhaps part of the education range.
(b) Missingness depends on wages
Step 3. At each education level, high earners drop out. Respondents' average wage is pulled down most where wages are highest (high education).
Step 4. That flattens the line: attenuation bias.
Answer: selection on leaves the slope unbiased; selection on biases it toward zero (see the MNAR setting in the Lab).
Exercise 15 · Potential outcomes as missing data
In an RCT with 50% treated, which potential outcome is missing for each unit, what is the "response probability" for , and which estimator of does IPW give?
Show solution
Step 1. Treated units are missing ; controls are missing .
Step 2. is observed when , which happens with probability 0.5 for everyone: the missingness is MCAR.
Step 3. IPW for : . The Hájek version divides by the realised number treated instead, giving the treated-group mean.
Step 4. If the propensity depends on covariates, , the weights become for and for .
Answer: every causal estimate fills in missing potential outcomes; with a known or estimated propensity, Step 4 is the IPW estimator of the ATE (Day 44).
Verify in Python
import numpy as np
rng = np.random.default_rng(14)
n = 1_000_000
old = rng.random(n) < 0.5
Y = np.where(old, rng.normal(40, 5, n), rng.normal(20, 5, n))
pi = np.where(old, 0.8, 0.4)
R = rng.random(n) < pi # MAR: depends on age only
print("true mean :", Y.mean().round(2))
print("complete cases :", Y[R].mean().round(2))
print("IPW (HT) :", (R * Y / pi).mean().round(2))
print("IPW (Hajek) :", ((R * Y / pi).sum() / (R / pi).sum()).round(2))
# Rubin's rules (Exercise 10)
Q = np.array([10.2, 9.8, 10.5, 10.0, 9.5]); W = 0.25
B = Q.var(ddof=1); T = W + (1 + 1 / len(Q)) * B
print("pooled", Q.mean(), " total var", round(T, 3), " SE", round(np.sqrt(T), 3))
# MNAR attenuates a regression slope
educ = rng.normal(13, 2, 200_000)
wage = 5 + 2 * educ + rng.normal(0, 6, 200_000)
keep = rng.random(200_000) < 1 / (1 + np.exp((wage - 30) / 4)) # high earners drop out
print("slope full:", np.polyfit(educ, wage, 1)[0].round(3), " slope MNAR sample:", np.polyfit(educ[keep], wage[keep], 1)[0].round(3))
Key takeaways
- MCAR is harmless for bias; MAR is fixable with the right covariates; MNAR needs extra assumptions or bounds.
- IPW weights each respondent by the inverse of its response probability; it requires MAR and overlap.
- Every causal estimate fills in missing potential outcomes, so these ideas reappear throughout the course.
Simulation Lab: Missing-Data Mechanisms
Open full screen →MCAR, MAR and MNAR on an education–wage scatter: complete-case bias, IPW repair and slope attenuation.
Hollow points are missing wages. IPW re-weights respondents by the inverse of their education group's response rate. It repairs MAR, but no model on education can repair MNAR.