ML0113 Missing Data Handling

How do you handle missing data: what do MCAR, MAR, and MNAR mean, when is dropping vs imputing wrong, and how do missing-indicator features fit in?

Consider a credit-approval model for a card issuer such as Capital One. Self-reported income is blank on 14% of historical applications, several other fields have gaps, and the deployed model must still score every live application, including the ones with blanks.

Line-art scene: on the left, a training table of six loan applications with columns id, age, income, tenure, balance and default, where several cells are blank and marked with a question mark; an arrow labeled train points to a credit model box; on the right, a live application card with income left blank points to the same model with an arrow labeled score; below the model, the questions why is each value blank, drop the row, fill it in, or tell the model it was blank

The Problem: A credit model is trained on historical applications with blank cells in several columns, and it must also score live applications whose fields can be blank. Before choosing between dropping, filling, or flagging, you need to know why each value is missing.

Answer

Handling missing data starts with asking why a value is missing, because the right fix depends on the missingness mechanism rather than on the missing rate. In Rubin’s taxonomy, MCAR means blanks are independent of all data, MAR means they depend only on observed features, and MNAR means they depend on the missing value itself. Dropping rows is unbiased only under MCAR, still wastes data, and is impossible at serving, where every request must be scored. Mean or median filling keeps the center but shrinks variance and correlations under every mechanism, while conditional imputers such as KNN or MICE are valid under MAR. Under MNAR the blank itself carries signal, so a missing-indicator feature or native NaN routing in boosted trees captures what no fill value can. Every imputer is fit on the training fold only and replayed identically at serving.

(1) Diagnose Before Fixing: Predict each column’s missingness flag from the other observed columns, and an AUC near 0.5 is consistent with MCAR. MAR versus MNAR cannot be tested from the data alone and needs domain evidence.
(2) Dropping Compounds: With 10 features each 5% MCAR-missing, listwise deletion keeps only 0.95^{10} \approx 0.60 of rows. Under MAR or MNAR the surviving rows are also a biased sample.
(3) Mean Filling Distorts: Filling a fraction p with one value scales variance by about (1-p) and correlations by about \sqrt{1-p}. It also creates an artificial spike that trees will happily split on.
(4) Conditional Imputation For MAR: KNN, MICE (chained equations), or a per-column model predict the blank from observed features. Use multiple imputation when you need honest standard errors.
(5) Indicators Carry MNAR Signal: A binary is-missing column, or the learned default direction in XGBoost and LightGBM, lets the model treat a blank as information rather than noise.
(6) Fit On Train, Replay At Serving: Imputation statistics are model parameters. Fitting them on all rows leaks test information, and recomputing them at serving causes training-serving skew.

Mathematical Formulation:
\mathrm{MCAR}:\ P(R \mid Y_{obs}, Y_{mis}) = P(R)
\mathrm{MAR}:\ P(R \mid Y_{obs}, Y_{mis}) = P(R \mid Y_{obs})
\mathrm{MNAR}:\ P(R \mid Y_{obs}, Y_{mis}) \neq P(R \mid Y_{obs})
\mathrm{Var}(\tilde{x}) \approx (1-p)\,\sigma_x^2
\rho(\tilde{x}, y) \approx \sqrt{1-p}\;\rho(x, y)

Where:

  • R is the missingness indicator matrix, with R_{ij} = 1 when feature j of row i is blank; Y_{obs} and Y_{mis} are the observed and missing parts of the data.
  • Under MCAR the pattern ignores all values, under MAR it depends only on what you can see, and under MNAR it still depends on Y_{mis} after conditioning on Y_{obs}, which is why MNAR cannot be verified from observed data alone.
  • \tilde{x} is the mean-imputed column, p the fraction of rows filled, \sigma_x^2 the true variance, and \rho the Pearson correlation with any other variable y; both approximations hold under MCAR for large samples.
  • At p = 0.3, variance falls to 70% of its true value and a true correlation of 0.60 is reported as about 0.60 \times 0.837 \approx 0.50.

Worked Example:
Suppose 80% of applicants earn about 60k and 20% earn about 200k. High earners leave income blank 50% of the time, everyone else 5% of the time, which is an MNAR pattern. The true mean, the observed share, and the mean of the observed rows are:

\mu_{true} = 0.8(60) + 0.2(200) = 88
P(\mathrm{obs}) = 0.8(0.95) + 0.2(0.5) = 0.86
\mu_{obs} = (45.6 + 20) / 0.86 \approx 76.3

Complete-case analysis and mean filling both anchor on 76.3k, about 13% below the truth. Worse, 0.10 / 0.14 \approx 0.71 of the blank rows are actually high earners, so filling them with 76.3k is wrong in a systematic direction. A missing indicator lets the model learn that a blank income usually means a high income, which is exactly the signal an imputer fitted on observed rows cannot fully recover.


Login to view more content
Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *