Gaps and odd values, drop or fill?
Five ways to handle missing values side by side, the pairs people confuse, and one run where dropping rows gets the mean wrong and the slope right.
prints on 2 A4 pagesfrom 4 pages and 1 cataloguefree to read · PDF with a free accountUpdated 24 Oct 2026
The PDF and the Print button ask you to sign in; a free account is enough. Reading and Test yourself are open to everyone.
Side by side
The first columns are the Missing-data methods catalogue’s; the rest come from each page.
A formula is printed only when it is shorter than the words; the others are said in words, and each page has its formula.
Easy to confuse
The “what is the difference between…” questions, in two lines each.
MAR vs MNAR
MAR, the gaps depend on columns you have; MNAR, on the missing values themselves.
MAR, impute from those columns; MNAR, no method fixes it, so show how far the answer moves.
Filled value vs Missing indicator
Filling makes a gap look observed; an indicator column keeps the fact that it was blank.
Fill and add the indicator; that a value was not recorded is often a signal.
Outlier vs Error
An outlier is unusual; an error is wrong. A test finds the first, only the data's origin proves the second.
Delete only what you can show is wrong; keep the rest and use a robust method.
Fitted on all data vs Fitted in the fold
An imputer or scaler fitted on all the data has seen the test rows; one fitted in the fold has not.
Always in the fold, inside the pipeline that is cross-validated.
One real run
Each method under each mechanism, 35 to 40% of y deleted, against the truth on top.
| Method | MCAR slope | MAR mean | MAR slope | MAR corr. | MNAR mean |
|---|---|---|---|---|---|
| truth | 2.00 | 1.00 | 2.00 | 0.89 | 1.00 |
| complete case | 1.99 | 0.13 | 2.00 | 0.86 | 0.04 |
| mean imputation | 1.30 | 0.13 | 0.88 | 0.57 | 0.04 |
| regression imputation | 1.99 | 1.01 | 2.00 | 0.93 | 0.76 |
| + resampled residuals | 1.99 | 1.01 | 2.00 | 0.89 | 0.76 |
“Mean imputation is not a mild approximation — it is a transformation of the data.”
“Under MAR, which estimate you wanted decides whether you have a problem.”
“Under MNAR nothing works.”
The run and these lines are the worked example on Missing data, as it printed: each method under each mechanism, against the truth
Which one?
What is wrong with the column?
- Some values are missing Missing data
- Some values are extreme Outliers
- It is text or a category Feature engineering
Where are the imputer and scaler fitted?
- On all the data Data leakage
Each answer is from its page’s “Why & when”.
All 21 traps on these pages
Each is the opening line of a pitfall; its page says why.
Missing data
- Assuming MCAR because it is convenient.
- Mean imputation on a modelling feature.
- Fitting the imputer before the split.
- Dropping the missingness indicator
- Trusting an interval or a p-value computed after single imputation.
- Expecting a better algorithm to solve MNAR.
Outliers
- Using |Z| > 3 on a small sample.
- Running a single-outlier test repeatedly.
- Testing for outliers without checking the distribution.
- Deleting on the strength of a test alone.
- Removing outliers from the test set.
- Treating robustness as free.
Feature engineering
- Fitting the transform on all the data.
- Leaking the target.
- Training/serving skew.
- Ordinal encoding of unordered categories.
Data leakage
- Believing a pipeline is enough.
- Random splits on grouped data.
- Deduplicating after splitting
- Tuning on the test set.
- Resampling before the split.