Robust Statistics
What survives when a few observations are wrong, or the tails are heavier than the model admits?
In 1960 Tukey sets the standard deviation against the mean absolute deviation under a normal contaminated by a few observations with three times the spread: the textbook winner loses once one observation in 570 is a gross error. Newcomb's 66 passage times of light, with strays at -44 and -2, show the same thing on real data: the mean moves by a point and a half, the robust estimates barely at all, and none comes near the modern value. The part measures robustness three ways. Pitman efficiency: the Wilcoxon test never loses more than 13.6% against t, and the Hodges-Lehmann estimator inherits that. Influence: on the estimator rail one dragged point pulls the mean without limit and the median hardly at all. Breakdown: the share of bad points an estimate can absorb, from none for the mean to half for the median. Huber's minimax problem then produces the clipped psi, and the same ideas are carried to scale (MAD, Qn, Sn), regression (LTS and MM on the CYG OB1 stars, where least squares gets the slope's sign wrong), covariance (MCD) and heavy-tailed means (median of means, Catoni). It ends on the World, where 10% of heights recorded in inches break the t interval and the Hodges-Lehmann interval alike.
What you need. Part 16's rank tests and Walsh averages, Part 22's M-estimation asymptotics and Part 23's least squares with leverage; the calculus of variations is introduced where it is used.
- Hook
- Tukey's contaminated normal, 1960
- Mathematics
- Pitman efficiency and the 0.864 bound, influence, breakdown, Huber's minimax, LTS, MM, MCD, median-of-means
- Built
- statkit.robust
What you will be able to do
Bachelor's
- Explain on Newcomb's data why one stray observation moves the mean and the standard deviation but not the median or the MAD.
- Find the breakdown point of the mean, a trimmed mean and the median by replacing points one at a time.
Master's
- Derive the Wilcoxon test's efficacy and its efficiency 3/pi at the normal, and the bound 108/125 by the calculus of variations.
- Compute influence functions of the mean, median, trimmed mean and Huber's estimator, and the Hodges-Lehmann breakdown point.
- Derive Huber's least favourable distribution and implement his estimator by iteratively reweighted least squares.
PhD
- Prove the median-of-means deviation bound from Chebyshev and Hoeffding, and say what Catoni's estimator needs to know.
- State the neighbourhood in which Huber's estimator is minimax and why a bounded influence function does not imply a high breakdown point in regression.
Practice
- Flag outliers with a median and MAD rule and explain masking under the three-SD rule.
- Fit a regression with a high-breakdown start (LTS or MM) and use its residuals and MCD distances to find leverage points that least squares hides.
- Say what robustness does not protect against: a systematic error common to the whole sample.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Bachelor's 12 min · Master's 48 min · PhD 54 min · Practice 20 min.
- 0Tukey's contamination and Newcomb's lightBachelor's4 min
- 1Pitman efficiencyMaster's5 min
- 2Hodges--LehmannMaster's3 min
- 3Influence functionsMaster's5 min
- 4BreakdownBachelor's4 min
- 5Huber's minimax estimatorMaster's6 min
- 6Robust scalePractice4 min
- 7Robust regressionMaster's6 min
- 8Robust multivariateMaster's3 min
- 9Heavy-tailed meansPhD6 min
- 10Contamination on the WorldPractice4 min
- Recap, problems, and the road aheadAll tracks3 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film.
Tukey's contamination and Newcomb's lightBachelor's4 min
In 1920 Fisher settled an argument with Arthur Eddington: for normal data, the standard deviation estimates spread better than the mean absolute deviation, about twelve percent better. In 1960 John Tukey asked what happens when the data are almost normal: most observations from one normal, and now and then one from a normal three times as wide, a gross error. His answer reshaped statistics.
The problem is old. Astronomers argued about discarding doubtful observations for a century: Benjamin Peirce proposed a criterion in 1852, and William Chauvenet's rule of 1863, reject a point if fewer than half an observation that extreme is expected, was taught for generations. Newcomb himself, in 1886, modelled measurement errors as a mixture of normals with different spreads, Tukey's model seventy-four years early. The rules' weakness is that they judge points by the mean and standard deviation that the outliers themselves distort.
Tukey's model: a share epsilon of the observations comes from a normal with three times the standard deviation, the rest from the main normal. The standard deviation squares each deviation, which magnifies the far points. The mean absolute deviation doesn't, as much. Compare them by the ratio of their squared coefficients of variation: the kurtosis minus one, divided by four, against variance divided by mean absolute deviation squared, minus one.
At epsilon zero, the standard deviation wins, as Fisher said: the mean deviation is only eighty-eight percent as efficient. But the curve rises fast. They break even at epsilon of point oh oh one eight: one gross error in five hundred and seventy observations. At one in a hundred, the crude mean deviation is forty-four percent more efficient. At one in twenty, twice as efficient. This shows sensitivity to one specific wider-normal mixture, rather than a measured universal rate of errors in real data. An optimal procedure for a model can perform poorly nearby.
Real data, with a known answer. In 1882 Simon Newcomb timed light crossing the Potomac to a mirror and back, in a series of sixty-six measurements. Stephen Stigler used his measurements in 1977 to test estimators against the truth. Most cluster in the twenties and thirties; two stray far below, at minus forty-four and minus two. The modern value of the speed of light corresponds to thirty-three point oh two on this scale.
Six estimates of the centre. The mean of all sixty-six is twenty-six point two; drop the two strays and it jumps to twenty-seven point seven five. The median, the trimmed mean, Hodges–Lehmann, Huber's and the biweight barely notice: the robust estimates range from about twenty-seven to twenty-seven point seven across these analyses. That is robustness. And not one of them reaches thirty-three. The remaining discrepancy suggests a systematic component that these location estimators do not remove; Stigler's real lesson was that robustness protects against stray points, not against bias.
Stigler did this for twenty-four historical data sets with known answers: Cavendish's density of the earth, Michelson's and Newcomb's speeds of light. Lightly trimmed means were competitive in this historical comparison. The plain mean was surprisingly close behind. Aggressive resistance to isolated outliers does not remove a common systematic measurement error. Our Newcomb calculation illustrates that limitation; it does not establish a universal ranking of estimators. Robustness is insurance, not a cure.
The lesson: an estimator that is optimal when the model is exactly true can be poor when the model is nearly true. This part measures estimators in two ways: efficiency, how much we lose when the model holds; and influence and breakdown, how much damage a few bad points can do. The goal is to lose little when all is well, and to fail gracefully when it isn't.
Numbers: break-even ε = 0.0018; mean 26.2 vs 27.5 robust vs 33.0 true
1Pitman efficiencyMaster's5 min
Part 16 quoted two numbers: the Wilcoxon test is ninety-five and a half percent as efficient as the t-test for normal data, and under the regular symmetric finite-variance location assumptions, never less than eighty-six point four percent. It didn't show where they come from. Now we derive both.
Edwin Pitman's idea: compare tests on alternatives that close in on the null as n grows, at rate one over root n, so that power stays strictly between the level and one. Each test statistic is approximately normal, with a mean that drifts with theta and a variance over n. Its efficacy is the squared slope of the drift at zero over the variance: signal squared over noise, per observation. The ratio of efficacies is the limiting ratio of the sample sizes the two tests need for the same power.
The simplest case first: the sign test, John Arbuthnot's of 1710, counts the positive observations. Under the null the count is binomial with probability a half. Under a shift theta, the probability of a positive observation rises by theta times f of zero, and the variance is a quarter, so the efficacy is four f of zero squared. Against the t-test the efficiency is four sigma squared f of zero squared: two over pi at the normal, sixty-four percent, because the sign test throws away the sizes. At the Laplace, it is two: there, ignoring sizes is exactly right.
For the t-test the drift has slope one and the noise is the variance: efficacy one over sigma squared. The Wilcoxon signed-rank statistic, scaled, estimates the probability that a Walsh average is positive. Differentiating under the integral, its drift has slope twice the integral of f squared, and by Hoeffding's projection its variance is one third: efficacy twelve times the integral of f squared, squared. Their ratio is twelve sigma squared times that integral squared. At the normal the integral is one over two root pi, and the ratio is three over pi, ninety-five point five percent.
The efficiency across eleven distributions. At the normal, point nine five five. At every heavier-tailed distribution, the logistic, the Laplace, the t distributions and the contaminated normals, the rank test wins: by ten percent at the logistic, fifty at the Laplace, ninety at t with three degrees of freedom. At the uniform they tie. And at one peculiar distribution, a parabola, the rank test does worst: eighty-six point four percent. That is the local asymptotic bound over the stated regular finite-variance density class.
The bound is a calculus-of-variations problem. The efficiency is scale-free, so fix the variance at one and minimize the integral of f squared over densities. With Lagrange multipliers, wherever f is positive it must be a downward parabola, exactly Part 29's Epanechnikov argument: three over twenty root five times five minus x squared. Plugging in gives one hundred and eight over one hundred and twenty-five, point eight six four: Joseph Hodges and Erich Lehmann's theorem of 1956. For this Wilcoxon comparison under the location assumptions, local asymptotic efficiency is at least point eight six four and can be arbitrarily large. This is not a universal finite-sample power comparison.
One more step. Replace each rank by the corresponding normal quantile: the normal-scores test. At the normal it is fully efficient; at the logistic it beats t by five percent; at t with three degrees of freedom by sixty-four. Herman Chernoff and Richard Savage proved in 1958 that its efficiency relative to t is at least one under the theorem's regular finite-variance location-model conditions. This is an asymptotic local-power result under its assumptions, not dominance at every sample size or alternative.
The same numbers are efficiencies of estimators. The median, which inverts the sign test, has efficiency two over pi relative to the mean at the normal, sixty-four percent. The Hodges–Lehmann estimator, inverting the signed-rank test, has three over pi. An estimator inherits the efficiency of the test it inverts. At the Laplace distribution the median is twice as efficient as the mean, and Hodges–Lehmann one and a half times.
Numbers: 2/π, 3/π, 0.864; normal scores ≥ 1
2Hodges--LehmannMaster's3 min
Hodges and Lehmann turned the test into an estimate. The signed-rank statistic, testing centre theta, counts the Walsh averages, the averages of all pairs of observations including each with itself, that exceed theta. At the true centre of a symmetric distribution, half of them should. So estimate the centre by the value that splits them in half: the median of the Walsh averages. It inherits the test's efficiency: ninety-five and a half percent at the normal, under the regular continuous symmetric finite-variance location assumptions, never below eighty-six point four, and sometimes far above one.
Eight observations, one far out at fourteen. Their thirty-six Walsh averages: each pair's midpoint. The far point creates eight averages of its own, spread towards the right, but the other twenty-eight crowd the middle. Their median is four point eight three. The mean, five point six, is dragged right; the median, four point eight, is not. Hodges–Lehmann sits with the median here, while using the data far more efficiently.
An interval comes the same way, by inverting the test, Part 11's duality: the centres the signed-rank test would accept form an interval between two ordered Walsh averages. Which two is read from the exact null distribution of the statistic, two to the n equally likely sign patterns. The coverage is exact for any continuous symmetric distribution. With eight observations it runs from the fourth smallest Walsh average to the thirty-third, with coverage ninety-six point one percent: the discreteness of the null means exact levels jump.
On Newcomb's data. The t interval for the mean of all sixty-six runs from twenty-three point six to twenty-eight point nine, widened by the two strays. Remove them by hand and it jumps and shrinks. The median's distribution-free interval: twenty-six to twenty-nine. Hodges–Lehmann's: twenty-six to twenty-eight and a half, almost the same whether the strays are in or out. The robust and hand-trimmed intervals are close in this example. The rounded historical data have ties, so the continuous signed-rank reference is not an exact tie-adjusted guarantee.
Darwin's maize, from Part 16: fifteen pairs, cross-fertilized minus self-fertilized height. The mean difference is twenty-one, with a t interval from just above zero to forty-two. Hodges–Lehmann's estimate is twenty-five, with a continuous signed-rank reference interval from four to forty-one and a half; the rounded differences contain ties. Two negative pairs pull the mean down and widen its interval; the robust estimate sits with the bulk of the pairs, and its interval excludes zero by a wider margin.
Its breakdown point, chapter four's measure, is one minus one over root two, about twenty-nine percent. It estimates the centre of symmetry; for skewed data it estimates something called the pseudo-median, neither mean nor median. For two samples, the same idea gives the median of all pairwise differences and an interval inverting the Mann–Whitney test. And for a regression slope, the median of pairwise slopes, Henri Theil's and Pranab Kumar Sen's estimator.
Numbers: Newcomb [26.0, 28.5]; Darwin 25.0 [4.0, 41.5]
3Influence functionsMaster's5 min
Frank Hampel's framework. Think of an estimator as a functional T of the distribution. Contaminate the distribution by moving a small mass epsilon to a single point z. To first order, the estimate moves by epsilon times a function of z: the influence function, the derivative of the functional in the direction of a point mass at z. Its sample version is Tukey's sensitivity curve: add one observation at z, and record n plus one times the change in the estimate.
The estimator rail, this part's instrument: two dozen of Newcomb's measurements on a line, and below, five estimates of their centre. Take the largest observation and drag it to the right. The mean follows it, without limit. In this demonstration the median and Hodges–Lehmann eventually stop responding to the point's distance. Huber's bounded residual score limits its direct effect, though estimating the scale can also matter. The biweight moves and then comes back: once the point is far enough out, it is given weight zero, as if rejected.
The rail shows the shape near the centre too. Slide the smallest point slowly from the left across the middle of the data. As a single sample point moves, the sample median is continuous and piecewise linear, changing which order statistics define it. Its population influence function has a step, a different limiting statement. Hodges–Lehmann and Huber glide smoothly, like the mean does, for points near the centre. They behave like the mean where the mean is good, and like the median where the mean fails.
The sensitivity curves, on all sixty-four clean measurements. The mean's is a straight line: one observation can move it anywhere. The median's is a step: it only cares which side of the centre the point is on. Hodges–Lehmann's and Huber's rise and level off. The biweight score returns to zero far out. A finite-sample sensitivity curve with an estimated MAD need not return exactly to zero, because adding a point can change the scale. Estimators with this shape are called redescending.
The worst influence, the supremum of its absolute value, is the gross-error sensitivity. For the mean the influence function is z minus mu: unbounded. For the median it is plus or minus one over twice the density at the median, at the standard normal one point two five, the minimum gross-error sensitivity among regular Fisher-consistent normal location functionals, with the appropriate equivariance and normalization constraints. For an M-estimator, the solution of a sum of psi functions equal to zero, it is psi itself, scaled: so you design the influence function by choosing psi.
The hook's duel, seen through influence functions. Treat the standard deviation as a functional of the distribution. At the normal its influence function is half of z squared minus one: quadratic, so a point at ten standard units has influence forty-nine point five; comparison with a typical point depends on which point is chosen. The mean deviation's is the absolute value of z minus a constant: only linear. Both are unbounded, but one grows far faster, which is exactly why Tukey's rare wide errors hurt the standard deviation so much more.
The theoretical influence functions at the standard normal. The mean's line. The median's step, at one point two five. The trimmed mean and Huber's estimate are linear in the middle, like the mean, and clipped at about one point six: almost the mean's efficiency, with bounded influence. The biweight is linear near zero, peaks at one point seven seven, and returns to zero beyond four point six nine standard units.
Two facts make the influence function central. It averages to zero over the distribution. Its mean square is the estimator's asymptotic variance, Part 22's sandwich in another form. Because the estimator, to first order, is the average of the influence of each observation, the von Mises expansion. So bounded influence and small variance pull against each other, and the best compromise is chapter five's problem.
Hampel posed the trade-off as an optimization: minimize the variance at the normal, subject to a bound c on the gross-error sensitivity. The solution is the identity, clipped at plus and minus k: Huber's psi again, reached from a different question, which is part of why it is so widely used. As c falls to its smallest possible value, root pi over two, k shrinks to zero and the solution becomes the median, the least gross-error-sensitive solution within this regular normal-location problem, rather than under every definition of robustness.
Numbers: γ* 1.25 (median), 1.64 (Huber)
4BreakdownBachelor's4 min
Influence is local: one point, a small mass. Breakdown is global: the smallest fraction of the data that, replaced by arbitrary values, can carry the estimate arbitrarily far. Frank Hampel defined it in 1971, and David Donoho and Peter Huber gave this finite-sample form. The mean breaks down with a single point. The median survives until half the data are bad. And one half is the asymptotic upper breakdown bound for location-equivariant procedures: beyond it, nothing distinguishes the good half from the bad.
For scale estimates, breakdown has two directions. Outliers can blow a scale up: explosion. Or contamination can collapse it to zero: implosion. The MAD can implode when a majority of observations coincide, with exact finite-sample thresholds depending on the median convention, which heavily rounded data can produce, and then every other point looks infinitely far away. A scale's breakdown point is the smaller of the two, and Qn's design guards against both.
On Newcomb's sixty-four clean measurements, replace the largest m by a thousand, one at a time. The mean leaves the chart at once. The ten and twenty percent trimmed means hold until their trimming is used up, at seven and thirteen bad points. Hodges–Lehmann holds to nineteen, twenty-nine percent. The median and Huber's estimate, with its MAD scale, hold until half the data are bad, though Huber's drifts upwards as the bad points accumulate: high breakdown limits the worst case, but bias still grows.
Breakdown and efficiency together. The mean: full efficiency, zero breakdown. Trimmed means: breakdown equal to the trimming, efficiency ninety-four and eighty-nine percent. Hodges–Lehmann: ninety-five point five percent efficient, twenty-nine percent breakdown. The median: half, but only sixty-four percent efficient. And Huber's estimate with a MAD scale gets both: ninety-five percent efficiency and fifty percent breakdown. The two properties are separate, and good estimators need both.
Below breakdown, how far can contamination push an estimate? The maximal bias curve plots the worst shift for each share epsilon, the contaminant placed adversarially, here at plus infinity. For the mean it is infinite for any epsilon at all. For the median it is the normal quantile at one over two times one minus epsilon: point one four standard deviations at ten percent, rising to infinity at a half. Huber's estimate is pushed a little further, point one nine at ten percent, the price of its efficiency. Within the stated normal-location contamination framework and equivariant class, the median minimizes maximal bias. This plot holds the scale known; it is not the maximal-bias curve of our MAD-scaled sample Huber algorithm.
Where twenty-nine percent comes from. A Walsh average is clean only if both of its points are. The estimate breaks when half of the Walsh averages are contaminated. With a share epsilon bad, the clean-pair share is the square of one minus epsilon. Setting that to a half gives one minus one over root two: twenty-nine point three percent.
Breakdown is a worst case: arbitrary values, chosen adversarially. Below it, maximal bias curves say how far an estimator can be pushed for each share of contamination. In regression and in many dimensions, fifty percent breakdown is much harder to achieve, the subject of chapters seven and eight. And achieving it with computation that scales to high dimensions is recent work, Part 60.
Numbers: 1/64, 7, 13, 19, 32 points; maxbias 0.14σ
5Huber's minimax estimatorMaster's6 min
Peter Huber's 1964 paper made robustness a theorem. Take Tukey's neighbourhood: the normal, mixed with a share epsilon of any symmetric contaminant at all. An M-estimator defined by psi has asymptotic variance E psi squared over E psi prime, squared. Find the psi whose worst-case variance over the whole neighbourhood is smallest. It is a game: the statistician chooses psi, nature chooses the contaminant, and Huber found its saddle point.
Nature's best move is the member of the neighbourhood with the least Fisher information, the hardest to estimate the centre of. It is normal in the middle, scaled by one minus epsilon, with exponential tails beyond plus or minus k, the exponential continuation minimizing Fisher information in this neighbourhood; heavier contaminant tails are also allowed. k is fixed by requiring the density to integrate to one.
The statistician's best reply is the maximum likelihood estimator for that worst distribution, psi equal to minus f naught prime over f naught. In the middle it is x, the mean's psi; beyond k it is constant: Huber's clipped psi. Against it, no contaminant in the neighbourhood does more damage than f naught does, and at f naught no psi does better, by Cramér–Rao. A saddle point: Huber's estimator is minimax.
The minimax k for each amount of contamination. At one in a thousand, k is two point six three, and the price is under one percent of variance. At five percent, k is one point four, and the worst-case variance one point two six. At twenty percent, k falls below one. Against any of these neighbourhoods the mean's worst case is infinite. In practice k equal to one point three four five is used: ninety-five percent efficient at the normal, statkit's computation confirms.
The variance of Huber's estimate against k, with the contaminant a normal ten times as wide. With no contamination, larger k is better, approaching the mean. With five percent, the best k is about one and a half, variance one point two three, against the mean's six and the median's one point seven. With ten percent, the best k moves to about one point two. And the curves are flat near their minima, so k needn't be tuned exactly: one point three four five is good across the board.
In 1970 and 1971 six statisticians at Princeton, Andrews, Bickel, Hampel, Huber, Rogers and Tukey, ran a vast simulation of sixty-eight location estimators. Here is a small version: seven estimators, five distributions from the normal to the Cauchy, samples of twenty, efficiency relative to the best on each. In this simulation the mean is best at the normal. Its population mean-squared error is infinite under slash and Cauchy sampling, so no finite Monte Carlo average estimates that risk. The median never falls below sixty-eight percent, but never rises much above it except in the wild tails. Hodges–Lehmann and Huber are excellent until the tails become extreme. The redescending biweight has the best worst case, eighty-five percent, alongside the twenty-five percent trimmed mean. This teaching study compares seven estimators on five distributions; the displayed worst column is the worst of those five, not a minimax guarantee over all distributions.
The zoo of psi functions. The mean's is the identity. Huber's clips it: monotone, giving a convex objective; a flat interval of roots is possible if no observations supply local curvature. Tukey's biweight bends back to zero at four point six nine: redescending, so gross errors get no weight at all. Frank Hampel's three-part psi does the same with straight pieces. Redescending estimators reject far points cleanly, but their equations can have several roots, so they need a good, robust starting point, a lesson MM-regression builds on.
To compute it, solve the estimating equation. Write psi of u as a weight times u: for Huber, weight one in the middle and k over absolute u outside. Then the equation says mu is a weighted mean, and iterating, recompute the weights, recompute the mean, converges: iteratively reweighted least squares, Part 24's algorithm again. The residuals must be standardized by a scale that is itself robust, here the MAD, the subject of the next chapter.
The weights at convergence are worth looking at. Huber's estimate on Newcomb's data, with a MAD scale of four point four five. Sixteen points get weight below one, and minus forty-four only eight percent: still counted, but barely. The biweight gives both strays weight zero, rejecting them outright, and down-weights every other point a little, more the farther it lies from the centre. These weights are themselves the robust diagnosis: they say which observations the estimate decided not to trust, and how much.
Huber also proposed estimating scale and location together: his Proposal 2 adds a second equation, matching the average squared psi to its value at the normal. It is an available scale option in several packages; both MASS rlm and statsmodels RLM ordinarily use a MAD scale by default. But its breakdown point is lower than with a fixed MAD, because the scale can be inflated by the outliers it is supposed to judge, which is why modern practice fixes a high-breakdown scale first.
Numbers: k(0.05) = 1.398; Princeton worst cases
6Robust scalePractice4 min
The Analytical Methods Committee's copper data: twenty-four determinations of copper in wholemeal flour, one of which reads twenty-nine parts per million, nine times the rest. It pulls the mean to four point two eight and inflates the standard deviation to five point three. The median, three point three nine, and the robust scales, MAD point five three and Qn point six three, ignore it. Huber and Hodges–Lehmann sit at three point two. Removing the stray by hand gives a mean of three point two one and an SD of point six nine: the robust answers, without anyone having to decide what to delete.
The median absolute deviation: the median of the distances from the median, Hampel's choice, used by Gauss long before. Multiplying by one point four eight two six makes it estimate sigma at the normal. Its breakdown is fifty percent, the most possible. But it is only thirty-seven percent efficient at the normal, and it is a scale functional about the median for skewed distributions too; the multiplier is calibrated specifically to Gaussian standard deviation.
Masking happens in one dimension too. Apply the three-standard-deviation rule to Newcomb's data. The minus forty-four inflates the standard deviation to ten point seven, so it is flagged, at six and a half SDs, but minus two, at two point six, is not. Remove minus forty-four and recompute: the standard deviation drops to six point two, and now minus two is four point seven SDs out. One outlier hid another. With the median and three MADs, both are flagged in a single pass, at sixteen and six and a half MADs, because the MAD is not inflated by the points it judges.
Peter Rousseeuw and Christophe Croux proposed two better ones in 1993. Qn is a low order statistic, roughly the first quartile, of all pairwise distances, scaled by two point two two. Sn is low outer / high inner median; finite corrections included of pairwise distances. Neither explicitly estimates a centre. Their Gaussian consistency constants do not make them estimators of standard deviation for arbitrary skewed laws. Both keep fifty percent breakdown, and Qn is eighty-two percent efficient at the normal, more than twice the MAD.
A third kind: an M-estimate of scale, the s that makes the average of rho of the standardized residuals equal a constant b. With a bounded rho, like the biweight's, a huge residual counts at most one. For fixed-center scale estimation under the regular setup, both explosion and implosion matter: the asymptotic breakdown is the smaller of b over maximum rho and one minus that ratio. Choosing one half balances them. This M-scale is the engine inside the S- and MM-regression estimators of the next chapter.
The scale estimators side by side, with efficiencies measured on three thousand normal samples of a hundred. The standard deviation: five point three on the copper data, full efficiency, zero breakdown. The interquartile range and MAD: about point six, thirty-seven percent efficient. Sn: about fifty-eight percent. Qn: seventy-seven percent at this sample size, eighty-two in the limit, and fifty percent breakdown, computable fast.
Robust scale matters beyond reporting spread. Every M-estimate needs a scale to decide what counts as far, and that scale must be robust too. Median and MAD can give useful resistant diagnostic thresholds; a three-MAD rule is not a universal test, especially for skewed or rounded data, because outliers inflate the standard deviation and so hide themselves: masking. In regression the same problems return, in a worse form.
Numbers: copper SD 5.30 vs MAD 0.53; Qn 77% efficient
7Robust regressionMaster's6 min
The Hertzsprung–Russell diagram of the star cluster CYG OB1: forty-seven stars, log surface temperature against log brightness. Most lie on the main sequence, where hotter stars are brighter. Four are giants, cool and very bright, far to the left. Least squares, pulled by them, has a negative slope: it says cooler stars are brighter, true of neither group.
First try: Huber's M-estimator applied to regression, the estimating equation summing psi of each standardized residual times its row of the design. It bounds the influence of a large residual, but not of an outlying x: the row multiplies psi. A single bad leverage point can still break it. On the stars, Huber's regression gives slope minus point four three, no better than least squares, because the giants are leverage points that pull the line towards themselves and so don't even have large residuals.
One repair: generalized M-estimators, from Colin Mallows and Fred Schweppe, multiply each row's contribution by a weight depending on its x. Rows with high leverage get small weights. Now the influence is bounded in both x and the residual. But Ricardo Maronna, Oscar Bustos and Victor Yohai showed their breakdown point is at most one over p plus one, falling as predictors are added. High breakdown needs a different idea.
Peter Rousseeuw's answer, 1984: minimize the median of the squared residuals instead of their sum. Or, better behaved, least trimmed squares: the sum of only the h smallest squared residuals, with h about half of n. Under general position and a fixed predictor dimension, exact high-breakdown regression estimators can approach one-half breakdown. Finite-sample bounds depend on n, p and h; a random-start approximation is not a certificate of the global optimum. Finding the best half is combinatorial; FAST-LTS starts from many random small subsets and improves each by concentration steps, refitting least squares on the h best points, which can only lower the criterion.
S-estimators, from Rousseeuw and Yohai, generalize the idea: choose the coefficients that minimize a robust M-scale of the residuals. Least squares minimizes the residual mean square about zero. Using a centered residual standard deviation alone would leave the intercept unidentified. With a fifty percent breakdown scale, the fit inherits fifty percent breakdown. But Ola Hössjer proved that at fifty percent breakdown an S-estimator can be at most thirty-three percent efficient. High breakdown and high efficiency need two steps.
The fits. Least squares, sloping down. Least median of squares: slope four, through the densest part of the main sequence. Least trimmed squares, after the customary reweighting step: intercept minus eight and a half, slope three point oh five, for this seeded teaching implementation; tuning, corrections and algorithms can change software results. The MM-estimator: slope two point two six. They differ, because the main sequence itself is curved and scattered, but all of them describe the main sequence, and none is captured by the giants.
High breakdown alone is not enough: least trimmed squares is only seven percent efficient when the errors really are normal. Victor Yohai's MM-estimator fixes that in three steps. Start from a high-breakdown fit. Estimate the residual scale by a robust M-scale. Then run a biweight M-regression from that start with the scale held fixed: a redescending estimator with a robust start. Multiple roots and convergence remain computational issues; theoretical MM guarantees require the appropriate initial fit and objective conditions. The theoretical construction can combine asymptotic high breakdown and about ninety-five percent Gaussian efficiency, under the theoretical conditions. Our LTS-initialized fixed-scale fit is an MM-style illustration, not a certified global S/MM solution.
MM estimates come with standard errors: at the model the estimator is asymptotically normal, with the familiar covariance inflated by E psi squared over E psi prime squared. In practice the M-estimator's sandwich of Part 22 is used, which also allows uneven noise. Robust Wald tests and robust analogues of likelihood-ratio tests follow. But these intervals are valid near the model, not under arbitrary contamination: robust inference, like robust estimation, buys protection within a neighbourhood, not everywhere.
Diagnostics tell the same story. Standardized by least squares, no residual exceeds two and a half: the giants have pulled the line so close that they look ordinary. Standardized by LTS, the four giants stand out far above the band, with stars seven and nine, two smaller anomalies. Least squares residuals mask exactly the points that matter; robust residuals reveal them.
Practical advice: fit both robustly and by least squares, and when they disagree, find out why. Compare robust and ordinary residual diagnostics; neither a large residual nor a robust weight proves a data error. Use MM for estimates and inference, LTS for diagnosis. And treat an outlier as a question: here the four points were not errors at all, but a different kind of star.
Numbers: slopes −0.41 vs 3.05 / 2.26
8Robust multivariateMaster's3 min
In many dimensions, outliers are judged by Mahalanobis distance from the mean, in the metric of the covariance, Part 5's tool. Points beyond the chi-squared cut-off are flagged. But a cluster of outliers inflates the covariance and drags the mean towards itself, so its own distances shrink: masking. And the displaced centre can push genuine points beyond the cut-off: swamping.
Rousseeuw's minimum covariance determinant estimator looks for the h points, about half, whose covariance matrix has the smallest determinant: the tightest ellipsoid holding half the data. Their mean and rescaled covariance estimate the centre and shape. FAST-MCD, Rousseeuw and Van Driessen's algorithm of 1999, improves random starts by concentration steps: keep the h points closest under the current estimate, and the determinant can only fall. For fixed dimension, general position and a suitable h, the exact MCD breakdown approaches one half. Random starts and finite-sample covariance corrections affect the teaching algorithm.
Hawkins, Bradu and Kass built a data set to defeat classical diagnostics: seventy-five points in three dimensions, with ten bad-leverage cases and four additional good-leverage cases in the regression construction. We analyze the predictor geometry here. The distance–distance plot puts each point's classical distance against its robust one. Classical distances flag just two points, and not the worst ones. The ten planted bad points, in red, have classical distances of about two: perfectly masked. Their robust distances are around thirty, far beyond the cut-off, and the MCD flags all fourteen remote predictor cases in this example. This does not classify all fourteen as bad response measurements.
Two of the three coordinates show why. The classical ninety-seven and a half percent ellipse is stretched along the line towards the outliers, wide enough to swallow them. The MCD's ellipse is a small tight disc around the sixty-one good points, and the remote predictor cases lie outside it. A predictor outlier can still follow the response model. The outliers built the classical ellipse that then declared them normal.
A second route, from Werner Stahel and David Donoho: measure how outlying each point is in its worst one-dimensional projection, standardized robustly by median and MAD. Down-weight points by that outlyingness, and take the weighted mean and covariance. Under suitable general-position and sample-size conditions the exact-direction construction can approach one-half breakdown, but the supremum over all directions must be approximated by random ones, and the cost grows with dimension.
The MCD is the robust starting point for principal components, discriminant analysis and regression with many predictors, the next part's territory. But its cost grows quickly with dimension. High-dimensional robust estimation, through Tukey's depth and spectral filtering, returns in Part 60. And always look at the data: the distance–distance plot is itself the diagnosis.
Numbers: 2 vs 14 flagged
9Heavy-tailed meansPhD6 min
A different goal. Sometimes we want the mean itself, of income or of a loss, and the data are skewed, so the median, Hodges–Lehmann and trimmed means all estimate something else. Suppose only that the variance is finite. Then the sample mean's deviations always obey Chebyshev; without extra distributional assumptions no uniformly sub-Gaussian sample-mean bound follows. In particular, its tails can be polynomial, so a rare huge observation spoils it. What we'd like is a sub-Gaussian guarantee: error of order sigma root log one over delta over n, with probability one minus delta, as if the data were normal.
For a symmetric distribution with an existing mean, the mean and symmetric trimmed means equal the symmetry center; medians may be nonunique without additional conditions. For a skewed one they are different functionals, and each estimator converges to its own. The Pareto distribution of this chapter has mean point eight three but median point three seven. So the robust location estimators of the earlier chapters are not robust estimators of the mean: they answer a different question.
The median of means, found independently by Arkadi Nemirovski and David Yudin, by Mark Jerrum, Leslie Valiant and Vijay Vazirani, and by Noga Alon, Yossi Matias and Mario Szegedy. Split the sample into k blocks. Average each block. Report the median of the block means. A single huge observation can ruin one block's mean, but the median ignores a minority of ruined blocks.
The proof is three lines. For equally sized independent blocks, each has n over k points, so by Chebyshev its mean is more than two sigma root k over n from mu with probability at most a quarter. For the median to be that far off, at least half the blocks must fail. The number of failing blocks is at most binomial with probability a quarter, and by Hoeffding's inequality reaching half has probability below e to the minus k over eight. Choose k as the ceiling of eight log one over delta, with at least one observation per block. For unequal blocks use the floor of n over k in the error bound: the error is below a constant times sigma root log one over delta over n, with probability one minus delta. A sub-Gaussian guarantee from a variance alone.
Olivier Catoni found an M-estimator with the optimal constant. Its psi grows only like a logarithm, so huge observations have little pull. Its tuning alpha uses the confidence level and a supplied upper bound on the variance. Our simulation supplies the true Lomax variance, rather than substituting an unverified sample variance. Its deviation bound matches the normal's sample mean, root two sigma root log one over delta over n, to first order. Gábor Lugosi and Shahar Mendelson extended these ideas to vectors and to learning.
In many dimensions, applying median of means coordinate by coordinate loses a factor that grows with dimension. Gábor Lugosi and Shahar Mendelson's tournaments compare block means in every direction and pick the point that wins most contests. They achieve the error a Gaussian sample mean would have, with only a covariance assumed. Making that computable in polynomial time took until 2019 and 2020, in work by Samuel Hopkins and others, and it is part of Part 60.
A race on four thousand samples of five hundred from a Pareto distribution with shape two point two: finite variance, infinite third moment, a long right tail. Quantiles of the absolute error. The sample mean has median absolute error about point oh five five, but its empirical point nine nine nine error is point eight one. Catoni with the known variance has median error about point oh five two here. In this experiment the fixed-fraction trimmed mean does not consistently target the original mean: it cuts the long tail and is biased by a quarter. The median of twenty means gives up a little in the middle and has an empirical point nine nine nine error quantile around point two six in this run. It does not cap the largest possible error. Here Catoni with the known variance has a one-in-a-thousand error about point two eight. That empirical quantile is based on only four expected tail observations and is not a finite-sample guarantee. When the tail matters, the right question is not average error but the guarantee at a confidence level.
Robust to what? Gross errors and heavy tails are different problems. If a few observations are wrong and the rest symmetric, estimate the centre with Huber or Hodges–Lehmann. If every observation is genuine but the distribution has a heavy tail and you want its mean, use median of means or Catoni. And if an adversary corrupts a fraction of high-dimensional data, Part 60 has the modern answers.
Numbers: 99.9% error 0.81 vs 0.26
10Contamination on the WorldPractice4 min
The Board tests both kinds of interval on the World. The target: the mean height of its adult women, a hundred and sixty-three centimetres. Draw thirty women, apply the usual t interval and the continuous-symmetry signed-rank reference, two thousand times. We score both against the latent population mean; HL targets a pseudo-median under asymmetry, so its mean coverage here is an empirical diagnostic, not a general guarantee. Clean measurements. Gross errors: a tenth of the readings get a large random error, symmetric, standard deviation forty centimetres. And unit errors: a tenth are written down in inches, a one-sided error of about a hundred centimetres.
Before the results, a prediction. When errors are symmetric, the centre of symmetry doesn't move, so robust estimates still aim at the truth. Without restrictions on one-sided contamination the clean center is not generally identifiable from the observed distribution alone. These ordinary location functionals can shift. A robust estimate moves less, chapter four's bounded maximal bias, but it does move. And because an interval shrinks like one over root n while the bias stays fixed, coverage under one-sided contamination gets worse as the sample grows.
The results. Clean data: both intervals cover ninety-five percent, with almost the same width, about four point eight centimetres; Hodges–Lehmann's efficiency loss is barely visible. With symmetric gross errors, the t interval still covers, ninety-six percent, but it is almost ten centimetres wide; Hodges–Lehmann's covers ninety-five percent and is forty percent shorter. With unit errors, all pointing one way, the t interval covers only seventy percent, and Hodges–Lehmann's eighty-seven: better, but not safe. One-sided errors bias every estimator of the centre.
What do practitioners actually do? Often: drop points more than three MADs from the median, then compute an ordinary t interval on what remains. On the unit errors this works remarkably well: it drops about three points and covers ninety-four percent, with a narrow interval, because an error of a hundred centimetres is easy to see. But on clean data it covers only ninety-three: it trims genuine tails and then pretends nothing was trimmed, a little of Part 28's selection problem. Rejection rules are a judgement about the kind of error expected, and they should be reported as such.
On the Board. Clean: both kept. Symmetric gross errors: the t interval is flagged conservative or kept, wasting width; Hodges–Lehmann kept. Unit errors: both broken, the t interval badly. The Board's verdicts are only about coverage; the widths say the rest.
The Board can measure coverage because the World's truth is known. With real data nobody knows whether contamination is present, or of which kind. So report both the classical and the robust analysis, as Tukey urged. When they agree, little is lost; when they differ, the difference is itself the finding, and the data deserve a closer look.
So robust methods cost little when the data are clean, and pay off when errors are occasional and symmetric. These resistant location estimators do not identify an unknown common systematic shift; external calibration or an explicit identifiable error model is needed. The inches written as centimetres and Newcomb's measurements, all short of thirty-three, teach the same lesson.
Numbers: 70.1% vs 87.3%; HL 40% narrower
Recap, problems, and the road aheadAll tracks3 min
Part thirty in twelve lines. Tukey showed that one gross error in five hundred and seventy is enough to make the standard deviation lose to a cruder rival. Newcomb's light gave robust estimates that agreed with each other and still fell short of the truth. The Wilcoxon test is three over pi as efficient as t at the normal with a point eight six four lower local asymptotic bound under the stated regular location assumptions. Hodges and Lehmann turned it into an estimate, the median of the Walsh averages. Influence functions measure what one point can do, breakdown what a fraction can. Huber's clipped psi is the minimax M-estimator. Robust scale comes from the MAD and Qn. Least trimmed squares and MM regression ignore the giant stars. The minimum covariance determinant unmasks hidden outliers. With iid sampling and a confidence-dependent feasible block count, median of means yields sub-Gaussian deviation bounds from finite variance. And on the World, robust intervals have a small width cost when these data are clean and are forty percent shorter under the simulated symmetric errors, while one-sided errors defeat them all.
A promise for later. This part showed that a fraction of gross errors can be survived, by the median, by Huber's estimate, by the minimum covariance determinant. All in low dimension: the MCD's cost explodes as dimension grows. Part 60 brings Tukey's depth and the recent algorithms that estimate a mean robustly in high dimension, efficiently and with optimal error.
Where it comes back. Part 31 makes principal components and covariance robust. Part 32 selects variables with heavy-tailed losses. Part 34 builds conformal prediction on ranks. Part 36's doubly robust estimators are robust in a different sense, to a wrong model. Part 49 makes influence functions the heart of semiparametric efficiency. Part 51 proves concentration for heavy tails. Part 57 shows no t-interval can be valid over all distributions. And Part 60 takes robustness to high dimensions.
Six problems, with full solutions in the README. The Wilcoxon efficacy and three over pi; the Hodges–Lehmann bound; the trimmed mean's influence function; Hodges–Lehmann's breakdown point; Huber's least favourable density; and the median-of-means bound. Pause here if you want to try them.
The books this part follows: Huber and Ronchetti; Hampel, Ronchetti, Rousseeuw and Stahel on influence functions; Maronna, Martin, Yohai and Salibián-Barrera; Rousseeuw and Leroy on robust regression; and Lehmann's Nonparametrics; with the papers from Tukey to Lugosi and Mendelson.
Thirty parts of sixty-five. We can estimate when the model is only nearly right, and say what bad data can and cannot do. Chapter eight already showed that many variables make everything harder. Part 31 studies the geometry of many variables properly: the Wishart distribution, Hotelling's T squared, principal components, and the surprises that appear when the number of variables grows with the sample size. Multivariate analysis.
Where it goes next. Robust covariance returns in Part 31 and heavy-tailed losses in Part 32; influence functions become the central tool of semiparametric theory in Part 49, the heavy-tailed bounds are proved by concentration in Part 51, and robustness in high dimensions, with Tukey depth, is Part 60.
Key results
The part's results in one place, for revision.
Try it
Lab 30 · A little contamination: efficiency, variance and breakdown
Under Tukey's contaminated normal (1 - eps) N(0, 1) + eps N(0, 9), compare the standard deviation with the mean absolute deviation by formula and by simulation. Then estimate a centre under 5% contamination with the mean, the median and Huber's estimator, and find the breakdown point of each estimate on Newcomb's data.
python -m videos.stats.labs 30
needs numpy, scipy, matplotlib · download lab30.py ·
source on GitHubARE(d : s) at eps = 0, 0.01, 0.05, by formula 0.876, 1.44, 2.03 (film: 0.876, 1.44, 2.03)
the two break even at eps = 0.0018, one gross error in 570 (film: 0.0018, 1 in 570)
the same ratio simulated at n = 100: eps = 0, 0.05 0.89, 1.88
n Var of the mean at 5% contamination 6.34 (theory 0.95 + 0.05 x 100 = 5.95)
n Var of the median 1.71 (film: 1.72)
n Var of Huber's estimate, k = 1.345 1.29 (known-scale theory 1.23)
breakdown on Newcomb's 64: mean, Hodges-Lehmann, median 1, 19, 32 points (film: 1, 19, 32)
The classical estimates are the most efficient at the exact normal and the first to fail away from it: two gross errors in a thousand are enough to reverse Tukey's duel, and one point can carry the mean anywhere.
The code (90 lines; it asserts its own result)
"""Lab 30: replay Tukey's duel between two measures of spread, then contaminate a sample and see which estimates survive."""
import numpy as np
from scipy import optimize
from videos.coursekit import labs
from explainer.stats import museum
from explainer.stats.kit import robust
TITLE = "A little contamination: efficiency, variance and breakdown"
GOAL = ("Under Tukey's contaminated normal (1 - eps) N(0, 1) + eps N(0, 9), compare the standard deviation with the mean "
"absolute deviation by formula and by simulation. Then estimate a centre under 5% contamination with the mean, "
"the median and Huber's estimator, and find the breakdown point of each estimate on Newcomb's data.")
TASKS = [
"Change Huber's k from 1.345 to robust.huber_k(0.05) = 1.398 and then to 0.5 and 3. Which k gives the smallest variance at 5%?",
"Add robust.m_location(x, 'biweight') to the three estimators. Does a redescending psi beat Huber when the contaminant is N(0, 10^2)?",
"Make the contamination one-sided (add 10 instead of multiplying by 10). Which estimates are now biased, and by how much?",
]
def duel(eps):
"""Asymptotic relative efficiency of the mean absolute deviation d to the standard deviation s (Tukey 1960)."""
m2, m4, m1 = 1 + 8 * eps, 3 + 240 * eps, np.sqrt(2 / np.pi) * (1 + 2 * eps)
return ((m4 / m2 ** 2 - 1) / 4) / ((m2 - m1 ** 2) / m1 ** 2)
def contaminated(rng, shape, eps, scale):
return rng.standard_normal(shape) * np.where(rng.random(shape) < eps, scale, 1.0)
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
# 1. Tukey's duel: s against d.
even = optimize.brentq(lambda e: duel(e) - 1, 1e-6, 0.05)
lab.row("ARE(d : s) at eps = 0, 0.01, 0.05, by formula", f"{duel(0):.3f}, {duel(0.01):.2f}, {duel(0.05):.2f} (film: 0.876, 1.44, 2.03)")
lab.row("the two break even at eps =", f"{even:.4f}, one gross error in {1 / even:.0f} (film: 0.0018, 1 in 570)")
assert abs(duel(0) - 0.876) < 1e-3 and abs(duel(0.01) - 1.44) < 0.01 and abs(duel(0.05) - 2.03) < 0.01
assert abs(even - 0.0018) < 1e-4
n, reps, sim = 100, 4000, {}
for eps in (0.0, 0.05):
x = contaminated(rng, (reps, n), eps, 3.0)
s = x.std(axis=1, ddof=1)
d = np.abs(x - x.mean(axis=1, keepdims=True)).mean(axis=1)
sim[eps] = (s.var() / s.mean() ** 2) / (d.var() / d.mean() ** 2)
lab.row("the same ratio simulated at n = 100: eps = 0, 0.05", f"{sim[0.0]:.2f}, {sim[0.05]:.2f}")
assert abs(sim[0.0] - duel(0)) < 0.08 and sim[0.05] > 1.5, "five gross errors in a hundred reverse the ranking"
# 2. Location under 5% contamination by N(0, 10^2): n times the variance of each estimate.
eps, reps2 = 0.05, 2000
x = contaminated(rng, (reps2, n), eps, 10.0)
est = {"mean": x.mean(axis=1), "median": np.median(x, axis=1),
"Huber": np.array([robust.m_location(row, "huber")["mu"] for row in x])}
nvar = {k: n * v.var() for k, v in est.items()}
huber_theory = robust.contaminated_variance(lambda t: robust.psi_huber(t, 1.345), eps, 10.0)
lab.row("n Var of the mean at 5% contamination", f"{nvar['mean']:.2f} (theory 0.95 + 0.05 x 100 = 5.95)")
lab.row("n Var of the median", f"{nvar['median']:.2f} (film: 1.72)")
lab.row("n Var of Huber's estimate, k = 1.345", f"{nvar['Huber']:.2f} (known-scale theory {huber_theory:.2f})")
assert abs(nvar["mean"] / 5.95 - 1) < 0.2 and abs(nvar["median"] / 1.72 - 1) < 0.2
assert nvar["Huber"] < nvar["median"] < nvar["mean"] and abs(nvar["Huber"] / huber_theory - 1) < 0.2
# 3. Breakdown on Newcomb's 64 clean passage times: replace m points by a huge value.
clean = np.sort(museum.newcomb())[2:]
bd = {"mean": robust.empirical_breakdown(np.mean, clean), "Hodges-Lehmann": robust.empirical_breakdown(robust.hodges_lehmann, clean),
"median": robust.empirical_breakdown(np.median, clean)}
lab.row("breakdown on Newcomb's 64: mean, Hodges-Lehmann, median",
f"{bd['mean'] * 64:.0f}, {bd['Hodges-Lehmann'] * 64:.0f}, {bd['median'] * 64:.0f} points (film: 1, 19, 32)")
assert bd["mean"] == 1 / 64 and bd["median"] == 0.5
assert abs(bd["Hodges-Lehmann"] - (1 - 1 / np.sqrt(2))) < 1 / 64, "Hodges-Lehmann breaks down at 1 - 1/sqrt(2)"
lab.note = ("The classical estimates are the most efficient at the exact normal and the first to fail away from it: "
"two gross errors in a thousand are enough to reverse Tukey's duel, and one point can carry the mean anywhere.")
fig, ax = labs.figure(2, size=(11, 4.2))
e = np.linspace(0, 0.1, 200)
ax[0].plot(e, duel(e), color=labs.GOLD, label="ARE(d : s), asymptotic")
ax[0].plot(list(sim), list(sim.values()), "o", color=labs.BLUE, label="simulated, n = 100")
ax[0].axhline(1, color=labs.MUTED, ls="--")
ax[0].axvline(even, color=labs.RED, lw=0.9, ls=":", label=f"break-even at eps = {even:.4f}")
ax[0].set(title="Tukey's duel: mean absolute deviation against s", xlabel="share eps of N(0, 9) contamination",
ylabel="efficiency of d relative to s")
ax[0].legend()
bins = np.linspace(-0.7, 0.7, 57)
for name, color in (("mean", labs.RED), ("median", labs.BLUE), ("Huber", labs.GOLD)):
ax[1].hist(est[name], bins=bins, density=True, histtype="step", lw=1.6, color=color,
label=f"{name}: n Var = {nvar[name]:.2f}")
ax[1].set(title="Estimates of a centre of 0, 5% contamination", xlabel="estimate (n = 100)", ylabel="density")
ax[1].legend()
lab.fig = fig
return lab
Now change it
- Change Huber's k from 1.345 to robust.huber_k(0.05) = 1.398 and then to 0.5 and 3. Which k gives the smallest variance at 5%?
- Add robust.m_location(x, 'biweight') to the three estimators. Does a redescending psi beat Huber when the contaminant is N(0, 10^2)?
- Make the contamination one-sided (add 10 instead of multiplying by 10). Which estimates are now biased, and by how much?
Problems, with solutions
Try each problem before opening its solution.
1. The Wilcoxon efficacy. Show that the Wilcoxon test's Pitman efficacy is \(12(\int f^2)^2\) and that \(\mathrm{ARE}(W : t) = 3/\pi\) at the normal.
Solution
Write W⁺/(n(n+1)/2) ≈ U = P̂(X_i + X_j > 0), a U-statistic. Under shift θ, μ(θ) = P(X₁ + X₂ + 2θ > 0) = ∫F(x + 2θ) f(x) dx for symmetric f, so μ′(0) = 2∫f². By Hoeffding's projection, Var U ≈ (4/n)Var(F(X)) = 4/(12n) = 1/(3n). The efficacy is μ′(0)²/(1/3) = 12(∫f²)². The t-test's efficacy is 1/σ², so the ARE is 12σ²(∫f²)². At the normal, ∫φ² = 1/(2√π), giving 12/(4π) = 3/π.
2. The 0.864 bound. Show that \(12\sigma^2(\int f^2)^2 \ge 108/125\) for every density with variance \(\sigma^2\), with equality at the parabola.
Solution
The ARE is invariant to scale, so fix σ² = 1 and minimize ∫f² over densities with ∫x²f = 1. With multipliers, the first variation gives 2f + a + bx² = 0 where f > 0, so f₀ = c(5 − x²)₊ after imposing the constraints, with c = 3/(20√5). For any admissible f = f₀ + δ: ∫δ = 0 and ∫x²δ = 0. Then ∫f² − ∫f₀² = 2∫f₀δ + ∫δ² ≥ 2∫f₀δ = −2c∫_{|x|>√5}(5 − x²)δ ≥ 0, since there δ = f ≥ 0 and 5 − x² < 0. So ∫f₀² = 3√5/25 is minimal, and the ARE is 12(3√5/25)² = 108/125.
3. The trimmed mean's influence function. Find the influence function of the \(\alpha\)-trimmed mean at a symmetric \(F\), and its gross-error sensitivity.
Solution
With q = F⁻¹(1 − α), the α-trimmed mean has, at a regular symmetric F, the same local influence function as the fixed-cutoff clipped-score functional. Its IF at z is min(max(z, −q), q)/(1 − 2α). It is linear in the middle and constant beyond q, so γ* = q/(1 − 2α). At the normal with α = 0.1: 1.2816/0.8 = 1.60.
4. Hodges–Lehmann's breakdown. Show that the Hodges–Lehmann estimator's asymptotic breakdown point is \(1 - 1/\sqrt2\).
Solution
With a share ε of points replaced, a Walsh average (x_i + x_j)/2 is uncontaminated only if both points are, a share (1 − ε)² of all pairs asymptotically. The median of the Walsh averages stays bounded while that share exceeds ½. Breakdown occurs at (1 − ε)² = ½, i.e. ε* = 1 − 1/√2 ≈ 0.293.
5. Huber's least favourable density. Verify that Huber's least favourable \(f_0\) integrates to 1 iff \(2\phi(k)/k - 2\Phi(-k) = \varepsilon/(1 - \varepsilon)\).
Solution
∫f₀ = (1 − ε)[(2Φ(k) − 1) + 2φ(k)∫_k^∞ e^{−k(x − k)}dx] = (1 − ε)[1 − 2Φ(−k) + 2φ(k)/k]. Setting this to 1 gives 2φ(k)/k − 2Φ(−k) = ε/(1 − ε). Its score is −f₀′/f₀ = x on |x| ≤ k and k·sign(x) beyond, Huber's ψ, and I(F₀) = (1 − ε)(2Φ(k) − 1).
6. The median-of-means bound. Prove the median-of-means bound: with \(k = \lceil 8 \log(1/\delta) \rceil\) blocks, \(|\hat\mu - \mu| \le 2\sigma\sqrt{2k/n}\) w.p. \(\ge 1 - \delta\).
Solution
Each block has m = n/k points, so by Chebyshev P(|X̄_j − μ| > 2σ/√m) ≤ 1/4. If the median of the k block means is more than 2σ/√m from μ, at least k/2 blocks are. The number of such blocks is Binomial(k, p) with p ≤ 1/4, and by Hoeffding P(Bin ≥ k/2) ≤ exp(−2k(1/4)²) = e^{−k/8}. With k = ⌈8 log(1/δ)⌉, the bound holds with probability at least 1 − δ: |μ̂ − μ| ≤ 2σ√(k/n) = 2σ√(8 log(1/δ)/n) when k divides n. Otherwise replace n/k by floor(n/k), and require 1 ≤ k ≤ n; the displayed exercise’s 2σ√(2k/n) bound follows for k ≤ n/2.
Notes and sources
Where it comes back
| Idea | Returns in |
|---|---|
| robust PCA and covariance | 31 |
| robust selection, heavy-tailed losses | 32 |
| rank-based conformal prediction | 34 |
| doubly robust estimation | 36 |
| influence functions in semiparametrics | 49 |
| concentration for heavy tails | 51 |
| Bahadur–Savage: no uniform t-interval | 57 |
| robustness in high dimensions; Tukey depth | 60 |
| the Coverage Board | every part; 65 |
Glossary
- Contaminated normal; gross-error model: (1 − ε)N + εH, a small share of bad data.
- Pitman efficiency; efficacy; ARE: power comparison on shrinking alternatives; signal²/noise per observation; the sample-size ratio.
- Sign test; Wilcoxon signed-rank; normal scores: rank tests of increasing efficiency.
- Walsh averages; Hodges–Lehmann estimator; pseudo-median: pairwise midpoints; their median; its target for skewed F.
- Influence function; sensitivity curve; gross-error sensitivity; von Mises expansion: the derivative of a functional towards a point mass; its sample version; its supremum; the linearization behind asymptotic variance.
- Breakdown point (finite-sample, asymptotic); explosion and implosion; maximal bias: the share of bad data that ruins an estimate, in either direction for scale; the worst bias below breakdown.
- M-estimator; ψ; ρ; IRLS; Huber's ψ; redescending (biweight, Hampel); least favourable distribution; minimax: estimating-equation estimators and their theory.
- MAD; Qn; Sn; M-scale; masking; swamping: robust scales, and how outliers hide and accuse.
- Leverage; GM-estimator; LMS; LTS; C-step; S-estimator; MM-estimator: robust regression and its algorithms.
- Mahalanobis distance; MCD; robust distance; distance–distance plot; Stahel–Donoho: robust multivariate location and scatter.
- Median of means; Catoni's estimator; sub-Gaussian deviation; tournament: heavy-tailed mean estimation.
Sources
- History.
- J. Tukey, in Contributions to Probability and Statistics (1960); S. Stigler, Ann. Stat. 5 (1977).
- S. Newcomb, Astronomical Papers 2 (1882), Amer. J. Math. 8 (1886).
- B. Peirce, Astron. J. 2 (1852); W. Chauvenet, Manual of Spherical and Practical Astronomy (1863).
- J. Arbuthnot, Phil. Trans. 27 (1710).
- Efficiency.
- E. Pitman, lecture notes (1948); J. Hodges & E. Lehmann, Ann. Math. Stat. 27 (1956), 34 (1963).
- H. Chernoff & R. Savage, Ann. Math. Stat. 29 (1958).
- Influence and breakdown.
- F. Hampel, Ann. Math. Stat. 42 (1971), JASA 69 (1974).
- D. Donoho & P. Huber, in A Festschrift for Erich Lehmann (1983).
- M-estimation.
- P. Huber, Ann. Math. Stat. 35 (1964).
- D. Andrews, P. Bickel, F. Hampel, P. Huber, W. Rogers & J. Tukey, Robust Estimates of Location (1972).
- Scale. P. Rousseeuw & C. Croux, JASA 88 (1993).
- Regression.
- P. Rousseeuw, JASA 79 (1984); P. Rousseeuw & V. Yohai (1984); V. Yohai, Ann. Stat. 15 (1987).
- P. Rousseeuw & K. Van Driessen, Data Min. Knowl. Disc. 12 (2006); R. Maronna, O. Bustos & V. Yohai (1979).
- C. Mallows (1975); O. Hössjer, Ann. Stat. 20 (1992).
- Multivariate.
- P. Rousseeuw & K. Van Driessen, Technometrics 41 (1999); W. Stahel (1981); D. Donoho (1982).
- D. Hawkins, D. Bradu & G. Kass, Technometrics 26 (1984).
- Heavy tails.
- A. Nemirovski & D. Yudin (1983); M. Jerrum, L. Valiant & V. Vazirani (1986); N. Alon, Y. Matias & M. Szegedy (1996).
- O. Catoni, Ann. IHP 48 (2012); G. Lugosi & S. Mendelson, Found. Comput. Math. 19 (2019); S. Hopkins, Ann. Stat. 48 (2020).
- Data.
- Analytical Methods Committee, Analyst 114 (1989); R. Humphreys, Astrophys. J. Suppl. 38 (1978).
- Books.
- P. Huber & E. Ronchetti, Robust Statistics (2nd ed., 2009).
- F. Hampel, E. Ronchetti, P. Rousseeuw & W. Stahel, Robust Statistics: The Approach Based on Influence Functions (1986).
- R. Maronna, D. Martin, V. Yohai & M. Salibián-Barrera, Robust Statistics (2nd ed., 2019).
- P. Rousseeuw & A. Leroy, Robust Regression and Outlier Detection (1987).
- E. Lehmann, Nonparametrics (1975).
About this partfrom its README
Part 30 of a sixty-five-part course in statistics, from a first course to a PhD (see the series plan and the syllabus), and the tenth part of Stage III, Master's. Part 29 estimated curves and introduced robust LOESS; most examples still assumed trustworthy observations. This part asks what survives when a few are not, or when the tails are heavier than any model admits:
- efficiency, and the Hodges–Lehmann estimator;
- influence functions and breakdown;
- Huber's minimax M-estimator; robust scale; robust regression (LMS, LTS, S, MM) and covariance (MCD);
- heavy-tailed means (median of means, Catoni).
Its instrument is the estimator rail (EstimatorRail): a sample on a number line with one observation on a tracker,
and a marker for each location estimate, recomputed every frame as the point is dragged. Its kit is statkit.robust.
It opens with Tukey's (1960) duel between the standard deviation s and the mean absolute deviation d under the contaminated normal (1 − ε)N(0, 1) + εN(0, 9):
- at ε = 0, ARE(d : s) = 0.876;
- the two break even at ε = 0.0018, one gross error in 570;
- at ε = 0.01 the ratio is 1.44 (1.32 by simulation at n = 100), and at ε = 0.05 it is 2.03.
Then Newcomb's 66 passage times of light (1882; Stigler 1977), with two strays at −44 and −2:
| Estimate | All 66 | Without the strays |
|---|---|---|
| mean | 26.21 [23.57, 28.85] | 27.75 [26.48, 29.02] |
| median | 27.0 [26, 29] | 27.5 |
| 10% trimmed mean | 27.43 | 27.67 |
| Hodges–Lehmann | 27.5 [26.0, 28.5] | 27.5 [26.5, 29.0] |
| Huber (k = 1.345) | 27.38 | 27.66 |
| biweight (c = 4.685) | 27.64 | 27.67 |
None comes near the modern value, 33.02: robustness protects against stray points, not against systematic error. This is also what Stigler found across 24 historical data sets.
From there the part covers:
-
Pitman efficiency.
-
The upgrade of Part 16. The sign test's efficacy 4f(0)², ARE 2/π. Wilcoxon's efficacy 12(∫f²)², ARE 3/π, derived.
-
The ARE of Wilcoxon to t:
Distribution ARE normal 0.955 logistic 1.097 Laplace 1.5 t₃ / t₅ / t₁₀ 1.90 / 1.24 / 1.05 1% / 5% / 10% contaminated 1.01 / 1.20 / 1.37 uniform 1.0 the parabola 0.864 -
The 0.864 bound by the calculus of variations (Hodges & Lehmann 1956).
-
Normal scores (Chernoff & Savage 1958): 1.000 at the normal, 1.047 logistic, 1.64 at t₃.
-
Estimators inherit their tests' efficiency.
-
-
Hodges–Lehmann (1963).
- Walsh averages; the exact interval from the signed-rank null. For n = 8, the interval is [w₍₄₎, w₍₃₃₎] with 96.1% coverage.
- Darwin's maize: mean 20.9, t interval [0.03, 41.8]; HL 25.0, interval [4.0, 41.5].
-
Influence functions (Hampel 1974).
- Sensitivity curves on Newcomb's data, and the estimator rail.
- Theoretical IFs at the normal: the mean is unbounded; the SD's is quadratic, ½(z² − 1); the median's is ±1.253. The 10% trimmed mean is clipped at ±1.60 and Huber at ±1.64; the biweight peaks at 1.77 and is zero beyond 4.685.
- The von Mises expansion; Hampel's optimality problem gives Huber's ψ again.
-
Breakdown (Hampel 1971; Donoho & Huber 1983).
- Newcomb's clean data with m points set to 1,000. The mean breaks at m = 1, the 10% and 20% trimmed means at 7 and 13, Hodges–Lehmann at 19 (29.7%), and the median and Huber (MAD scale) at 32 (50%).
- HL's 1 − 1/√2, derived; explosion and implosion.
- Maximal bias at 10% contamination: 0.14σ for the median and 0.19σ for Huber. The median is minimax-bias.
-
Huber (1964).
-
The minimax problem, the least favourable distribution and the clipped ψ, derived. k(ε) = 2.633 / 1.945 / 1.717 / 1.398 / 1.140 / 0.862 for ε = 0.001 / 0.01 / 0.02 / 0.05 / 0.1 / 0.2, with minimax variances 1.010 … 2.046.
-
Variance against k with a N(0, 10²) contaminant. At 5%, the best k is ≈ 1.5 with variance 1.23, against the mean's 5.95 and the median's 1.72.
-
ψ functions (Huber, biweight, Hampel); IRLS; Proposal 2; the weights on Newcomb (−44 gets 0.08 from Huber and 0 from the biweight).
-
A small Princeton Robustness Study (n = 20, 10,000 samples per distribution), efficiency relative to the best:
Estimate normal t₃ 10% contam. slash Cauchy worst mean 1.00 0.56 0.75 0.00 0.00 0.00 median 0.68 0.89 0.77 1.00 1.00 0.68 10% trimmed 0.95 0.93 1.00 0.47 0.35 0.35 25% trimmed 0.84 1.00 0.95 0.99 0.88 0.84 Hodges–Lehmann 0.94 0.96 0.99 0.77 0.65 0.65 Huber 0.94 0.96 1.00 0.79 0.66 0.66 biweight 0.92 0.96 0.99 0.96 0.85 0.85
-
-
Scale.
- The copper data (24 values, one at 28.95): mean 4.28, SD 5.30; median 3.385, MAD 0.526, Qn 0.633, Sn 0.799; Huber 3.216.
- 1-D masking on Newcomb: the 3-SD rule flags −44 (6.5 SD) but not −2 (2.6 SD) until a second pass (4.7 SD). The MAD rule flags both at once (16 and 6.5 MADs).
- Efficiencies at n = 100: MAD 0.36, Sn 0.58, Qn 0.77 (asymptotically 0.37, 0.58, 0.82); M-scales.
-
Robust regression on the CYG OB1 stars (47 stars, 4 giants):
Fit Intercept Slope least squares 6.79 −0.41 Huber M 6.87 −0.43 LMS −12.74 4.00 LTS (raw) −13.62 4.22 LTS (reweighted) −8.50 3.05 MM −5.02 2.26 These are seeded teaching fits. Finite corrections, tuning and initializations differ across packages; exact agreement with robustbase is not established here. LTS flags stars 7, 9, 11, 20, 30 and 34; least-squares residuals flag none. GM-estimators and their 1/(p + 1) bound; S-estimators and Hössjer's 33%; MM inference.
-
Robust multivariate. Hawkins–Bradu–Kass (75 × 3, ten bad-leverage and four additional good-leverage cases in the regression construction):
- classical distances flag 2 points, not the planted ten (masked at ≈ 2);
- MCD robust distances (≈ 30–41) flag all 14 remote predictor cases, without classifying their response quality;
- the classical and MCD 97.5% ellipses; Stahel–Donoho.
-
Heavy-tailed means.
-
Median of means, derived (k = 8 log(1/δ)); Catoni's estimator; vector versions.
-
Lomax (shifted Pareto, shape 2.2), n = 500, 4,000 samples, quantiles of |error|:
Estimator median 90% 99% 99.9% mean 0.055 0.134 0.312 0.813 5% trimmed 0.250 0.294 0.331 0.354 median of 20 means 0.087 0.165 0.223 0.261 Catoni (δ = 0.001, known variance bound) 0.052 0.121 0.184 0.280 The trimmed mean targets a different functional: the median is 0.37, the mean 0.83.
-
Data:
- Newcomb (Stigler 1977), the copper in flour (Analytical Methods Committee 1989), the CYG OB1 stars (Humphreys 1978; Rousseeuw & Leroy 1987), Hawkins–Bradu–Kass (1984) and Darwin's maize are the Museum's;
- the women's heights are the World's;
- the rest are seeded simulations.
Built in this part:
statkit.robust(explainer/stats/kit/robust.py), checked intests/test_stats_kit_robust.py:- Location: trimmed and winsorized means; Walsh averages, Hodges–Lehmann and its exact interval; the signed-rank null; Huber, biweight and Hampel ψ; M-location by IRLS.
- Scale: MAD, Qn, Sn.
- Influence and breakdown: sensitivity curves, influence functions, empirical breakdown.
- Efficiency: Wilcoxon ARE, M-estimator asymptotic variance, Huber's k(ε) and minimax variance.
- Regression: LMS, FAST-LTS with reweighting, M-scale, MM, Huber M.
- Multivariate: FAST-MCD and robust distances.
- Heavy tails: median of means, Catoni.
- The Museum gains
newcomb(),chem(),stars_cyg()andhbk(). - The estimator rail (
EstimatorRailinexplainer/stats/viz.py).
The Coverage Board gains six rows. 95% intervals for the World's adult women's mean height (163.01 cm), n = 30, 2,000 samples:
| Method | Setting | Achieved | Mean width (cm) | Verdict |
|---|---|---|---|---|
| t interval | clean | 95.2% | 4.72 | kept |
| Hodges–Lehmann | clean | 95.4% | 4.82 | kept |
| t interval | 10% gross errors ±N(0, 40²) | 96.3% | 9.85 | kept |
| Hodges–Lehmann | 10% gross errors | 95.2% | 5.91 | kept |
| t interval | 10% recorded in inches | 70.1% | 21.8 | broken |
| Hodges–Lehmann | 10% recorded in inches | 87.3% | 13.2 | broken |
A 3-MAD rejection rule followed by a t interval (not a Board row) covers:
- 92.9% on clean data;
- 92.8% with gross errors;
- 94.0% with the inch errors.
Scientific qualifications: the efficiency results concern regular continuous symmetric location models and local asymptotic power, rather than every finite sample or distribution. Signed-rank intervals use the continuous symmetry reference; historical rounded data contain ties. The local interval implementation uses its exact signed-rank reference even above n = 60, and returns infinite bounds when a requested two-sided confidence level cannot have finite nonrandom endpoints.
Sn uses the low outer/high inner medians and the documented robustbase finite-sample factors, replacing the kit’s averaged-even-median variant. Qn retains the original 2.2219 normalization and approximate historical finite corrections; it is not claimed to match every modern robustbase default. The finite sample median moves continuously and piecewise linearly when one point is dragged; a discontinuous population influence function describes a different limit. Estimated scales can also keep a finite-sample redescending sensitivity curve from returning exactly to zero.
Huber’s minimax theorem here assumes the known-scale symmetric contamination neighborhood; the maximal-bias curve also holds scale known. M-scale breakdown counts both explosion and implosion. Fixed predictor dimension, general position and appropriate objective/initialization conditions are needed for asymptotic LTS/MM/MCD guarantees. Random-start fits are numerical approximations, not certified global minimizers. Predictor-distance cutoffs are normal-reference diagnostics, not exact tests on fitted distances.
The Princeton-style comparison covers seven procedures and five distributions, not a universal minimax class. Slash and Cauchy sample means have infinite population MSE: their finite Monte Carlo MSE averages are diagnostics and cannot estimate that expectation; their population efficiency is zero. Catoni’s simulation explicitly supplies the true Lomax variance 7.638889 and a two-sided confidence tuning, replacing an unverified sample-variance plug-in. Empirical 99.9% error quantiles have only four expected tail observations in 4,000 replicates and do not cap possible errors. Twenty MOM blocks provide a different theorem failure bound, exp(−20/8) ≈ 0.082, so theoretical confidence levels are not matched in this descriptive race.
The World coverage rows evaluate both intervals against the latent female-population mean. HL targets a pseudo-median under asymmetry; its observed mean coverage is an empirical diagnostic rather than a general guarantee. Unknown common systematic shifts require external calibration or an identifiable error model.
Chapter notes
| # | Chapter | Numbers |
|---|---|---|
| 0 | Tukey's contamination and Newcomb's light | break-even ε = 0.0018; mean 26.2 vs 27.5 robust vs 33.0 true |
| 1 | Pitman efficiency | 2/π, 3/π, 0.864; normal scores ≥ 1 |
| 2 | Hodges–Lehmann | Newcomb [26.0, 28.5]; Darwin 25.0 [4.0, 41.5] |
| 3 | Influence functions | γ* 1.25 (median), 1.64 (Huber) |
| 4 | Breakdown | 1/64, 7, 13, 19, 32 points; maxbias 0.14σ |
| 5 | Huber's minimax estimator | k(0.05) = 1.398; Princeton worst cases |
| 6 | Robust scale | copper SD 5.30 vs MAD 0.53; Qn 77% efficient |
| 7 | Robust regression | slopes −0.41 vs 3.05 / 2.26 |
| 8 | Robust multivariate | 2 vs 14 flagged |
| 9 | Heavy-tailed means | 99.9% error 0.81 vs 0.26 |
| 10 | Contamination on the World | 70.1% vs 87.3%; HL 40% narrower |
| 11 | Outro | — |
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: Tukey (1960); Newcomb (1882) via Stigler (1977).
- Pitman efficiency. Wilcoxon vs t: 3/π at the normal and ≥ 0.864 always (Hodges & Lehmann 1956), derived; normal scores (Chernoff & Savage 1958).
- Hodges–Lehmann (1963).
- Gross-error models and influence functions (Hampel 1974); the
InfluenceProbe. - Breakdown (Hampel 1971; Donoho & Huber 1983).
- Huber (1964). The minimax M-estimator, derived; ψ-functions; IRLS.
- Scale. MAD, Qn, Sn.
- Robust regression. LMS, LTS, S- and MM-estimators.
- Robust multivariate. MCD; masking and swamping.
- Heavy-tailed means. Median-of-means, derived; Catoni.
- Contamination on the World (Board).
- Outro. Upgrade card for Part 60.
Built: statkit.robust. Data: Newcomb.
Build the film
python -m videos.stats.stats30.compute # the part's numbers, into .cache/stats30
python tools/build.py stats30 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py stats30 Hook # one chapter, silent, with a contact sheet
Scenes: videos/stats/stats30. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.stats.stats30.compute # once (a few minutes)
python tools/build.py stats30 -q l # fast 480p preview
python tools/build.py stats30 # 1080p30 -> renders/stats30.mp4
python tools/qa_scene.py stats30 Influence
python tools/lecture_length.py stats30 --floor 50