BanglayShikhi
← 🧹 Data Preparation

Missing values & outliers

4 min

Real datasets are messy. Some cells are empty (missing values) and some values sit far from the rest (outliers). Notice both before you analyse.

Why it matters

Missing values shrink your sample and can bias results. Outliers drag the mean and inflate the SD.

Key ideas

  • Report how many values are missing, and in which variables
  • Ask why they are missing — random or systematic?
  • Outlier rule of thumb: below Q1 − 1.5×IQR or above Q3 + 1.5×IQR
  • First check for typing errors, then decide and report your decision
  • Never delete a value just because it is inconvenient
  • Median and IQR resist outliers; mean and SD do not

Real-life research example

In a BMI survey one participant has BMI = 240. That is a typing error for 24.0. Correcting the entry is right; silently dropping the person is not.

When to use

  • Screen for missing values and outliers before every analysis
  • Run a sensitivity check: results with and without the suspicious value

When NOT to use

  • Don't fill missing values with the mean without justification
  • Don't remove outliers to obtain a significant p-value

Mini example

Values: 4, 5, 5, 6, 7, 8, 40
Q1 = 5, Q3 = 7.5, IQR = 2.5 → upper fence = 7.5 + 3.75 = 11.25
So 40 is an outlier. Mean = 10.7 but median = 6.

Quick takeaway

Look first, then clean. Every cleaning decision must be reported.

Try it yourself

Type your own numbers below and add one extreme value. Which value is flagged? How far does the mean move compared with the median?