Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Exploring and Explaining Data  ›  Lesson

Missing Values Have Reasons

Exploratory Data Analysis 14 minValues go missing at random, because of something recorded, or because of the missing value itself, and comparing rows with and without the value shows whether dropping or filling blanks would bias the result.

Missing Values Have Reasons

Pantry asks customers to rate every delivery, but 40% of orders have no rating. The dashboard simply ignores the blanks and shows an average of 4.45 stars. Before anyone celebrates, ask a simple question: who skips the rating? If the customers who stay silent are different from the ones who answer, 4.45 describes the talkers, not the customers.

The rule

Before filling or dropping blanks, ask why they are blank.

Blanks arise in roughly three ways, and each calls for a different response:

  • Unrelated to anything: a logging outage lost the ratings for three days. The gaps are a random slice of orders, so dropping them costs data but adds no bias.
  • Explained by something you recorded: an old app version never shows the rating prompt. The blanks depend on app_version, which you have, so you can compare like with like within each version.
  • Caused by the missing value itself: customers who had a bad delivery close the app without rating. Now the blanks hide exactly the low scores, and both dropping them and filling them with the average will overstate satisfaction.

You usually cannot prove which case you are in, but you can gather strong clues.

The shortcut

Compare the blanks with the non-blanks on columns you do have. If the two groups look alike, dropping is fairly safe. If they differ, the blanks are telling you something.

Who skips the rating?Step 1 of 4
  1. Split the orders

    60% of orders have a rating and 40% do not.

The weighting in the last step assumes that an unrated order would have scored like a rated order with the same lateness. It is an assumption, but a far more honest one than pretending the blanks are random. Filling every blank with the overall average is the worst of both worlds: it keeps the bias and makes the column look complete.

Drills

Answer fast — trust the rule.

quick drill

A server outage lost the ratings for all orders on three random days. Does dropping those rows bias the average rating?

60% of orders are rated, and 10% of those were late; 40% are unrated, and 30% of those were late. What share of all orders was late?
0.6×0.1+0.4×0.3= ?0.6 \times 0.1 + 0.4 \times 0.3 = \,?
Rated on-time orders average 4.6 stars and rated late ones 3.1. Weighting by 82% on time and 18% late, what is the adjusted average rating?
0.82×4.6+0.18×3.1= ?0.82 \times 4.6 + 0.18 \times 3.1 = \,?
quick drill

What happens if you fill every missing rating with the average of 4.45?

quick drill

You are building a churn model. What is a useful way to keep the information in the missing ratings?

Remember

  • Before filling or dropping blanks, ask why they are blank.
  • Compare rows with and without the value on columns you trust.
  • Trap: filling blanks with the average, which hides the missingness and keeps the bias.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainIs 4.45 stars honest?

The dashboard shows an average delivery rating of 4.45, computed from the 60% of orders that have a rating. Explain to the product lead why this may overstate satisfaction, what evidence you checked, and what number and caveat you would report instead.