Skip to content
tezvyn:
Menu

Missing Data Imputation: Filling in the Blanks

Source: Wikipedia: Missing data imputationMediumHow cards are made

Instead of deleting rows with missing values, imputation makes an educated guess to fill the blanks, preserving your sample size. It's used in survey analysis or time-series data where dropping records would introduce bias.

Why it exists

Missing data creates three core problems: it can introduce bias, complicate analysis, and reduce statistical efficiency. Many software packages default to 'listwise deletion'—discarding any row with a missing value. This can shrink your dataset dramatically and skew your results if the missingness isn't random.

The mental model

Think of imputation as statistical patching. You use the information you do have to make an educated guess about the information you don't. The goal isn't to find the 'true' value, but to create a complete dataset that can be analyzed with standard tools while minimizing the distortion caused by both the missing data and the patching process itself.

How it works

Imputation is a process of replacing missing data with substituted values. The strategy can be simple or complex. Simple methods include replacing all missing values in a column with the mean, median, or mode of that column. For time-series data, 'last observation carried forward' (LOCF) is common. More advanced techniques, like regression imputation, build a model to predict a missing value based on other available data for that record. Multiple imputation goes a step further by creating several different completed datasets to account for the uncertainty in the guesses.

When to use it

Use imputation when dropping rows with missing data would significantly reduce your sample size or introduce selection bias. It's essential when your analysis tools or machine learning models cannot handle null or NaN values and you want to preserve as much of your original data as possible.

When not to use it

Avoid simple imputation if you suspect the data is not missing at random, as your guesses will likely be systematically wrong and introduce bias. If a very high percentage of data is missing for a particular feature (>40-50%), imputation might just be adding noise; it's often better to drop the feature entirely. Never impute when the exact value is critical and an estimate is unacceptable.

One canonical example

Imagine a customer dataset where 15% of users didn't report their income. Deleting these users (listwise deletion) means losing all their other valuable data, like purchase history. A simple imputation strategy is to replace the missing incomes with the average income of all other users (mean imputation). A more sophisticated approach, regression imputation, would predict each missing income based on that user's other data, like their age, location, and job title, creating a more plausible estimate.

Interview question

What is the primary advantage of employing missing data imputation compared to listwise deletion?

  • a.It guarantees the recovery of the exact original values for all missing entries.
  • b.It significantly reduces the computational complexity of subsequent data analysis.
  • c.It maintains the original sample size and mitigates bias introduced by non-random missingness.Correct
  • d.It automatically detects and corrects all outliers present in the dataset.
Why?

The card explicitly states that imputation preserves sample size and helps address bias caused by missing data, which listwise deletion often worsens. It also clarifies that the goal of imputation is not to find the 'true' value, but to create a complete dataset for analysis.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on data science — each one lists the topics its interview covers.

See open roles