Robust Summary Statistics: Median and MAD
Summary numbers that don't panic when one data point is garbage — the median instead of the mean, and the median absolute deviation (MAD) instead of the standard deviation.
Prerequisites: Standard Deviation, Exploratory Data Analysis
The mean and standard deviation are the two numbers everyone reaches for first, and they share a hidden weakness: a single bad data point — a fat-fingered trade, a data feed glitch showing a price of $0 — can move them by an arbitrary amount. Robust statistics are versions of "center" and "spread" that are built to shrug off exactly that kind of contamination.
An analogy: the room and the billionaire
Ten people are in a room, earning $40,000 to $80,000 a year. The average income describes "a typical person here" reasonably well. Now a billionaire walks in. The average jumps into the hundreds of millions — describing nobody actually present. The median income barely moves: it is still whatever the middle person earns, because the median only cares about position, not magnitude. Robust statistics ask "where does this rank?" instead of "what is the size of this?"
Set the distribution above to something lopsided like this Poisson curve and compare its mean to its median — the two already disagree on ordinary, uncorrupted skewed data, before any outlier gets involved. A single contaminating point widens that gap further for the mean while barely touching the median.
The median and MAD, one symbol at a time
Sort your observations smallest to largest. The median is the middle value ( odd) or the average of the two middle values ( even). Unlike the mean , which adds up magnitudes, the median only uses each point's rank. Move the largest value from $100 to $100,000,000 and the median does not move at all — it doesn't care how far away that point is, only that it's still the largest.
The standard deviation measures spread by averaging squared distances from the mean, and squaring a huge outlier's distance makes its influence explode. The MAD fixes this the same way the median fixed the mean: it swaps every "average" step for a "median" step.
Read this left to right: take each data point , subtract the median ("x-tilde"), take the absolute value (so distance, not direction), and then take the median of all those distances — not the average. In plain English: MAD is "the typical distance of a point from the middle," where "typical" itself means the middle of the distances, so one huge distance can't hijack it.
To compare MAD to the standard deviation you know, scale it: for roughly normal data, . That constant makes MAD's units match the standard deviation's, so a MAD-based estimate can be dropped into any formula that expects .
Widen the standard deviation slider above and watch the bell curve flatten — a robust estimate of that same spread should track the true width even if a few points are corrupted, which is exactly what the standard deviation formula fails to do.
The median and MAD answer "where is the middle, and how spread out is the typical point" using only rank, not magnitude — so a single extreme, corrupted, or mistyped value can move them only a little, never by an unbounded amount.
Worked example 1: nine good trades, one bad print
Nine days of P&L, in thousands of dollars: . A tenth "trade" is a data feed error recorded as .
Mean of all ten: — a bad print turned a modest trading day into "$50,600 typical profit," nonsense.
Median of all ten: sorted, . With (even), the median averages the 5th and 6th values: — "typical day, about $1,000," untouched by the error at the far end.
Worked example 2: computing MAD by hand
Take the clean nine values above: . Sorted: . With (odd), the median is the 5th value: .
Absolute deviations from : , , , , , , , , . Sorted: . The median of these nine deviations (the 5th value) is . So .
Scaled to look like a standard deviation: (in $thousands). Compare that to the ordinary standard deviation of the same nine points, which works out to about — close, as it should be on clean data, confirming MAD is a reasonable stand-in even before any contamination arrives.
What this means in practice
- Screening live P&L or fill data. A robust z-score, , flags outliers without the outlier itself inflating the yardstick used to detect it — a problem the ordinary -score has, since a huge outlier also drags up the standard deviation used to measure it.
- Reporting "typical" trade size, slippage, or daily P&L to a desk — the median is a fairer description of what to expect than a mean dragged around by a handful of huge fills.
The classic mix-up is assuming the median and MAD are simply "better" and can replace the mean and standard deviation everywhere. They are less efficient on clean, well-behaved data — they discard information about magnitude that the mean uses. If your data genuinely has no outliers, the mean and standard deviation extract more from it; robustness is a trade you make specifically because you expect contamination, not a strict upgrade.
Related concepts
Practice in interviews
Further reading
- Huber, Robust Statistics, ch. 1
- Tukey, Exploratory Data Analysis, ch. 2