StatHarbor Analytics · Applied statistics course
Missing Data: From Diagnosis to Sensitivity Analysis
A blank cell is not a zero. Learn to tell what your data say, what your assumptions add, and when the conclusion changes.
Lesson 1
Start with the question
Learning goal. Define the target population, outcome and comparison before deciding how to handle blanks.
Imagine two cohorts of 500 people. The outcome is whether each person had an event by day 30. In A, 40 of the 400 people with recorded outcomes had an event. In B, 75 of 500 did. Comparing 10% with 15% answers a question about the people with records. We want the difference in 30-day risk in the two full cohorts. The comparison is descriptive, not a causal effect.
| Status | A | B |
|---|---|---|
| Enrolled | 500 | 500 |
| Known event | 40 | 75 |
| Known no event | 360 | 425 |
| Unknown | 100 | 0 |
An event not captured in a database is not necessarily an event that did not happen. A question skipped by design is not ordinary item nonresponse. Death before a scheduled quality-of-life measurement may leave the outcome undefined; say how death enters the study question before choosing an estimator.
Lesson 2
MCAR, MAR and MNAR
Let Y be the 30-day outcome, X a fully recorded baseline variable, and R an indicator: R = 1 if Y is known and R = 0 otherwise. Ask whether response still depends on Y once X is held fixed. These formulas describe the simple case of one partially observed outcome.
- MCAR · Missing completely at random
- Within the cohort, neither baseline characteristics nor the outcome affect observation. Example: records are lost in a genuinely random export failure.
- MAR · Missing at random
- Observation can differ by recorded baseline risk. Within the same baseline-risk stratum, event and non-event cases are equally likely to be recorded.
- MNAR · Missing not at random
- Even among people with the same recorded characteristics, those with events are less likely to be recorded, for example because their care took place outside the network.
For several incomplete variables, MAR concerns each missingness pattern and the values observed in that pattern; it is not a blanket claim of independence from every incomplete variable. MAR and MNAR generally cannot be distinguished from the observed values alone. Predicting R well does not establish MAR.
Check: Does more missingness in high-risk patients disprove MAR?
No. If baseline risk is observed, MAR allows the observation rate to differ by risk. It is the remaining relationship between R and unobserved Y within strata that matters.
Lesson 3
Audit what is missing
Start with a flow table, not an imputation command. Separate who was eligible, who entered the cohort, who had follow-up, and whose outcome can actually be classified.
- Report counts and denominators by variable, cohort, visit and site. Distinguish refused, not collected, structurally inapplicable and lost to follow-up.
- Compare measured characteristics by observation status. Describe monotone dropout (no later returns) versus intermittent missing visits.
- Check recording rules, enrollment windows and outside-network capture. Recover records with linkage, adjudication or consistent recontact where possible.
- Look for strata with very low or zero observation. A model cannot create direct information about a stratum with no observed outcomes.
An audit can discredit a simplistic assumption. It cannot tell you what the missing outcomes were.
Lesson 4
Deletion and simple imputation
For the cohort mean, deleting rows estimates the mean among people with observed outcomes. Under MCAR it can estimate the full-cohort population mean, usually with less precision. MCAR is sufficient, not necessary for every target: for instance, a correctly specified conditional outcome regression may remain valid if selection depends only on fully observed predictors. A marginal mean may still need standardization.
Mean imputation preserves the observed mean by construction. In the filled-in data, missing entries add zero to the sum of squared deviations while increasing its denominator. For a continuous outcome with n observed among N, the completed sample variance is ((n−1)/(N−1)) times the observed sample variance. A routine complete-data standard error also ignores the uncertainty about the filled values.
Think of the original deck’s scatterplot: filling missing outcomes with one number creates an artificial horizontal band. It can distort correlations and slopes; the direction of slope bias is not universal. Likewise, single regression imputation does not carry imputation uncertainty, and last observation carried forward assumes the value stays constant after the last measurement.
Check: If 20 of 100 continuous outcomes are replaced by the observed mean, what happens to the sample variance?
It becomes 79/99 of the observed sample variance, or about 80%. The calculation describes what mean imputation does mechanically, not how much variance the genuine missing values would have contributed.
Lesson 5
Estimate under MAR
Suppose baseline risk, X, is observed for everyone in A. Under MAR given X, we use the recorded event rate within each stratum to stand in for everyone in that stratum. This requires some observed outcomes in each stratum we want to represent.
| Baseline risk | Enrolled | Observed | Events | Risk among observed |
|---|---|---|---|---|
| Lower | 250 | 225 | 9 | 4.0% |
| Higher | 250 | 175 | 31 | 17.7% |
1. Outcome regression and standardization
Estimate m(x), the observed risk at X = x, then average those risks over everyone’s baseline X. Half the cohort is in each stratum, so give the two risks equal weight. Do not average them in proportion to the numbers observed.
The result is 10.86%, above the recorded-only 10% because the higher-risk stratum was underrepresented among recorded outcomes.
2. Inverse probability weighting for observation
Estimate π(x), the chance of observing Y given X. In A the observation rates are 0.90 and 0.70. Each observed person represents 1/π(x) people in their stratum. This is a weight for observation, not a treatment propensity score.
10.86% again. The estimates coincide here because both models use the same two fully stratified cells. With richer models they need not agree. Inspect small predicted probabilities, large weights and effective sample size; report any truncation because it can trade bias for stability. Inference should account for fitting the weights and the sampling or clustering design.
3. Augmented weighting
Start with each person’s predicted outcome m(X). For those observed, add the residual Y − m(X), multiplied by the inverse observation probability. This update is zero by convention for missing outcomes, so no missing Y is evaluated.
Under MAR and positivity this estimator can be consistent if either the outcome model or the observation model is correct, given appropriate estimation conditions. This is double robustness to model misspecification, not to MNAR, lack of support or invalid uncertainty estimates.
Reproduce the calculations in R
cohort_A <- data.frame(
enrolled = c(250, 250),
observed = c(225, 175),
events = c(9, 31)
)
with(cohort_A, c(
observed_only = sum(events) / sum(observed),
standardized = weighted.mean(events / observed, enrolled),
ipw = sum(events / (observed / enrolled)) / sum(enrolled)
))
# 0.1000000 0.1085714 0.1085714Lesson 6
Multiple imputation and likelihood
Multiple imputation treats missing values as uncertain draws. Generate multiple plausible completed datasets, fit the same analysis in each, and pool the estimates and variances. Chained equations (MICE) fit a conditional model for each incomplete variable in turn; for one incomplete binary outcome, stochastic draws from one fitted outcome model with parameter uncertainty suffice for this illustration.
- Include analysis variables and useful predictors of the missing values or observation, including the outcome when imputing covariates. Preserve important interactions, nonlinear terms, clustering and time structure.
- Check that draws respect the variable’s support. Compare distributions within relevant strata and inspect chain behavior when using MICE. Pick enough imputations for stable estimates and standard errors; three here is for arithmetic only.
- Fit the same analysis to each dataset. On a suitable scale, let Qⱼ be estimate j and Uⱼ its estimated variance. Average the estimates and combine the within- and between-imputation components.
Try three illustrative estimates (10.5%, 11.2%, 10.9%), with variances 0.00018, 0.00020 and 0.00019 on the proportion scale. Pooled risk: 10.87%; standard error: 1.44 percentage points. Do not stack the datasets as if they contained independent people. For intervals with finite m, use appropriate degrees of freedom.
When observed-data likelihood is a better fit
An observed-data likelihood integrates or sums over unobserved values instead of filling them in. A correctly specified joint longitudinal model can use partial outcome histories under an ignorable mechanism (MAR plus distinct model parameters). This does not fix a missing predictor the model never included, or dropout that depends on still-unobserved outcomes after accounting for the recorded history.
Lesson 7
Test departures from MAR
Learning goal. Find the assumptions that reverse the risk comparison and decide whether they are plausible.
Set how many of the 100 people with unknown outcomes in A actually had an event. All 500 people stay in the denominator. B stays at 75/500 = 15%.
10/100 assumed events
Risk in A: 10.0% · Risk in B: 15.0% · A − B: −5.0 pp
A has lower risk.
The tipping point is 35 events among the 100 unknown: then A has 75 events, just like B. Without any restriction on the missing values, the observed data allow a completed risk in A from 8% to 28%. The resulting A − B range is −7 to +13 percentage points. These are bounds from missing outcomes in the observed cohorts, not a confidence interval.
A more targeted sensitivity analysis can change the imputed outcome distribution within strata. For example, in a binary pattern-mixture model add a sensitivity parameter δ to the log odds of an event among people with a missing outcome, relative to observed people with the same X. δ = 0 recovers the MAR reference; positive δ makes events more likely among the missing. Justify the range with external data or subject-matter knowledge and report the values at which the decision changes. For a continuous outcome an additive shift in its units is often easier to interpret.
Lesson 8
When a covariate is missing
Learning goal. Explain why a missing adjustment variable is not the same problem as a missing outcome.
Now suppose the 30-day outcome is known, but baseline severity is missing for some people. You want to compare treatments after adjustment for severity. Dropping those people changes who contributes, and the remaining comparison can still be confounded. Treating “unknown severity” as a severity category generally does not adjust for the severity values that were never measured.
For an explanatory or causal analysis, a defensible imputation model for severity typically uses the treatment, the observed outcome and other useful measurements. Fit the intended adjustment procedure separately in each imputation and pool the effect estimates on a suitable scale. For a causal effect, missingness assumptions are additional to consistency, exchangeability and treatment positivity.
Check: Would you use future outcomes to impute inputs for a prediction at enrollment?
No. At deployment, future outcomes are unavailable. Fit and validate the entire prediction pipeline with only information available when the prediction is made. This is a different task from imputing a baseline covariate for an analysis of completed follow-up.
Lesson 9
When follow-up ends early
Learning goal. Distinguish a missed visit, dropout, and censoring, and explain why observation weights may change over time.
A person misses the 30-day visit but returns at day 60: that is intermittent missingness. A person leaves after day 30: subsequent visits are missing monotonically. If the endpoint is time to a first event and the person was known to be event-free through day 30, right censoring retains that partial history. It does not assign “no event” at day 60. A competing event, such as death before a nonfatal outcome, is not simply loss to follow-up.
If those with worsening recorded symptoms are more likely to leave, unconditional independent censoring may be implausible. An inverse probability of censoring weight can upweight people still followed who resemble those who left. At each visit, estimate the chance of remaining observed among those still followed just before that visit, given their recorded history. Multiply the successive probabilities and invert.
For example, if the chances of continuing at two visits are 0.90 then 0.80 given the relevant history, the unstabilized weight for a person who remains followed through both visits is 1/(0.90 × 0.80) ≈ 1.39. This requires conditional independent censoring given history, nonzero observation probabilities, and a suitable model. Symptoms that worsened but were never measured can still make censoring informative.
Lesson 10
Write the analysis plan
Before running the analysis, write a one-page plan for the two cohorts. Your aim is a comparison someone else can reproduce and challenge.
- State the target, time horizon and event definition; report observed and unknown counts by cohort and baseline risk.
- Choose a primary method and explain why its assumptions are plausible. Name the variables used and the checks you will make.
- Report an uncertainty interval using a method suitable for the design. Add missing-outcome sensitivity scenarios separately, including a decision threshold meaningful for the study.
- Explain what evidence would strengthen the analysis: for example link outside-network claims or audit a sample of unresolved records.
Compare your plan with a worked answer
The observed-only difference was −5 points. With standardization for baseline risk under MAR, the estimated difference was −4.14 points. Without assumptions restricting the missing outcomes, the completed-data contrast could lie anywhere from −7 to +13 points; it changes sign above 35 additional events. These results do not establish a causal effect. Follow-up auditing, not a more elaborate model alone, could narrow the plausible scenarios.
For the sampling interval, one option with independent people is to resample individuals separately within each cohort, refit the models and recompute the contrast. If inference conditions on fixed stratum sizes, preserve them in the resampling; if people are clustered, resample at the appropriate cluster level. The interval would quantify sampling variation under the primary assumptions, not replace sensitivity analysis.
In a causal analysis, handling missing outcomes does not remove confounding. Decide which treatment effect is of interest and justify treatment assignment, comparison, follow-up and missingness assumptions separately. With loss to follow-up over time, observation weights become sequential censoring weights based on recorded history.
References
Developed from the StatHarbor Analytics deck “When Clean Data Is Actually Dirty.” The course extends its survey examples, observation indicator, mean-imputation demonstration and practical checklist.