Quant Memo
Advanced

Robust Scale Estimators: Qn and Sn

Two ways to measure how spread out a batch of data is that, unlike the standard deviation, barely budge even if a large fraction of the data is contaminated with extreme values.

Prerequisites: Standard Deviation

Imagine a dataset where a quarter of the observations are garbage — bad ticks, fat-fingered trades, a data feed glitch. The standard deviation is ruined by even one huge outlier, since it squares every deviation from the mean. The median absolute deviation (MAD) fixes that but throws away almost all information about how the "good" data is actually spread, since it only measures distance to a single central point.

Qn and Sn, developed by Rousseeuw and Croux, instead look at all pairwise distances between points rather than distances from one center. Qn takes every pair of observations, computes the absolute difference xixj|x_i - x_j| for each pair, and reports (roughly) the first quartile of those differences, scaled by a constant so it estimates the standard deviation under a normal distribution. Sn instead computes, for each point, its median distance to every other point, then takes the median of those per-point medians. In plain English: instead of asking "how far is each point from the center?" both estimators ask "how far apart are typical pairs of points from each other?" — a question that doesn't require agreeing on a single center at all, which is exactly the step that breaks down under contamination.

Both estimators tolerate up to 50% of the data being arbitrarily corrupted before giving a nonsensical answer (their breakdown point), versus roughly 0% for the standard deviation and 50% for MAD — but Qn and Sn are noticeably more statistically efficient than MAD on clean, normal data, converging faster toward the true spread as sample size grows. That combination — MAD's robustness with better efficiency — is why they're used in quantitative pipelines that need robust volatility estimates but can't afford MAD's inefficiency on the 90% of days that are perfectly normal.

Qn and Sn estimate spread from pairwise distances between observations rather than distances to a single center, giving them the same 50% breakdown point as the median absolute deviation but noticeably better statistical efficiency on clean data.

Qn and Sn require O(n2)O(n^2) pairwise comparisons in their naive form, though efficient O(nlogn)O(n \log n) algorithms exist — using a naive implementation on large tick-level datasets without checking for a fast library implementation can silently make a "robust" statistic pipeline the slowest step in the whole computation.

Related concepts

Practice in interviews

Further reading

  • Rousseeuw & Croux, Alternatives to the Median Absolute Deviation
ShareTwitterLinkedIn