Outliers and Robust Statistics

One number can wreck an average. Put nine ordinary houses worth about £300,000 each on a street, then add the tech billionaire's £90-million mansion, and the "average house price" leaps past £9 million — a figure that describes not one single home on the street. The mean has been dragged away by a single outlier. The median, meanwhile, has not budged.

This is the whole subject of robust statistics: which summaries survive a few crazy values, and which collapse? Data scientists live among outliers — typos, broken sensors, fraud, genuine rare events — so knowing which tools are sturdy is not optional.

Move the outlier, watch the mean chase it

Below are nine well-behaved data points and one you can drag. Slide the outlier out to the right and watch the two summaries part company: the mean follows the outlier wherever it goes, while the median barely flinches.

That difference is not an accident of this example — it is a theorem about the two estimators, and it has a precise name.

The breakdown point

The breakdown point of an estimator is the smallest fraction of the data you would have to corrupt — push off to infinity — to send the estimate off to infinity with it. It is a purity test for robustness.

Fifty percent is the best any sensible estimator can do — past halfway, the "outliers" are the majority and there is no honest signal left. So the median is as robust as robust gets.

A robust ruler: the MAD

If the median is the robust replacement for the mean, the median absolute deviation (MAD) is the robust replacement for the standard deviation. Instead of averaging squared distances from the mean (which lets one huge distance dominate), it takes the median of the absolute distances from the median:

\mathrm{MAD} = \operatorname{median}_i \big(\, \lvert x_i - \operatorname{median}(x) \rvert \,\big).

To make it comparable to a standard deviation on normal data, it is usually scaled: \hat{\sigma} = 1.4826 \times \mathrm{MAD}. Because both the inner and outer summaries are medians, no single monster value can inflate it — its breakdown point is 50\%, versus 0 for the standard deviation.

Flagging outliers: the 1.5×IQR fence

The most common automatic rule, built into every box plot, uses the interquartile range — the width of the middle 50% of the data, \text{IQR} = Q_3 - Q_1. Tukey's fences call a point an outlier when it lies outside:

\big[\, Q_1 - 1.5\,\text{IQR}, \;\; Q_3 + 1.5\,\text{IQR} \,\big].

The rule is itself robust: Q_1 and Q_3 are quartiles, so the fence is set by the bulk of the data and is not itself blown out by the very points it is trying to catch. (A "3×IQR" fence marks the truly extreme "far" outliers.)

Deleting outliers reflexively is how you throw away the ozone hole. Through the early 1980s, NASA's satellite software automatically discarded Antarctic ozone readings that were "too low to be real" — so the collapse of the ozone layer went unseen in the data until British scientists, using ground instruments, spotted it in 1985. The extreme values were not errors; they were the single most important signal in the dataset. The moral is that an outlier is a question, not a verdict: it might be a fat-fingered typo (drop it), a broken sensor (fix or drop it), or the very rare event you were hired to find (treasure it). Always investigate before you delete.

The mean and standard deviation are the right pair only for roughly symmetric, outlier-free data — essentially, data that looks normal. Reach for them on income, house prices, insurance claims or web session times (all heavily right-skewed with fat tails) and they will systematically mislead: the mean sits above almost everyone, and the SD is bloated by the tail. Report the median and an IQR (or MAD) instead, and your summary will describe a typical case rather than an imaginary one. The failure is silent — the formulas happily return a number — which is exactly why it catches people out.

Learn this on Kaggle

Spotting and handling extreme values is a core skill in Kaggle Learn's free Data Cleaning course, where you will scale and sanity-check real, messy columns and decide — case by case — whether an outlier is an error to fix or a signal to keep.