Quant interview toolkit · robust estimation

One bad data block moves the mean. Three can move the median of means

A return feed contains a few suspect prints. The ordinary sample mean can move sharply when one observation is huge. The sample median resists that observation, but it targets the population median, which may differ from the expected return you want. Median-of-means tries to keep a mean target while making isolated bad blocks less powerful.

Build the estimator

Split nn observations into kk disjoint groups of roughly equal size. Compute the mean in each group, Xˉ1,…,Xˉk\bar X_1,\ldots,\bar X_k, then take their median:

μ^MoM=median⁡(Xˉ1,…,Xˉk).\widehat\mu_{\rm MoM}=\operatorname{median}(\bar X_1,\ldots,\bar X_k).

Imagine five groups whose clean means would all be zero. One corrupted group mean becomes 10. The ordinary mean of the five group means is 2; their median stays zero. With two corrupted groups at 10, the ordinary mean is 4 and the median still zero. With three corrupted groups, the median jumps to 10. The figure makes that block-level threshold visible.

This does not mean the method is immune to any two bad observations. If one bad observation lands in each of three groups, three group means can be contaminated. Random grouping can spread out contamination; it can also accidentally distribute a small number of outliers across many groups. The robustness claim concerns how many group estimates remain reliable, not a universal count of raw bad prints.

Why average inside groups?

If observations are independent with finite variance σ2\sigma^2, each group mean still estimates the population mean μ\mu and has variance about σ2/(n/k)=kσ2/n\sigma^2/(n/k)=k\sigma^2/n. Averaging within a group uses information that a raw sample median may discard when estimating μ\mu. Taking the median across groups reduces the influence of a minority of unusual group means.

There is a trade-off in choosing kk. More groups make it harder for a few bad groups to dominate the median, but each group contains fewer observations and its mean becomes noisier. The correct choice depends on the desired confidence level, sample size and contamination model. Under Cauchy data, even a group mean remains Cauchy; the usual finite-variance rationale does not apply. The Cauchy example is a reminder to state the tail assumption.

What to do with market data

Before reaching for a robust estimator, investigate whether extreme observations are real market events or data errors. Correcting a bad timestamp or split adjustment is different from suppressing a genuine crash. Keep a raw-data audit trail, compare estimates across reasonable groupings, and report how the strategy decision changes. If observations cluster in time, randomly mixing days across groups can hide regime dependence; block by time and test sensitivity to the block scheme.

What happens with skewed returns?

Suppose a strategy earns small losses most days and a large gain occasionally. Its population mean may be positive while its median return is negative. Replacing the mean with the raw sample median changes the question from expected cash return to a typical day’s return. Median-of-means retains a mean target by averaging inside each block, then uses the median to combine block estimates. It can therefore be a better match when the decision depends on expected P&L but a few observations threaten an ordinary mean.

It is still possible to lose the rare genuine gains by choosing blocks that are too short or by judging performance from an unrepresentative period. Report the group means themselves. If they disagree systematically by time, the problem may be regime change rather than a handful of outliers.

Median-of-means tolerates a minority of bad blocks

Median of five block means
Ordinary mean
Median of five block meansOrdinary mean

Each contaminated block mean is 10; each clean block mean is 0. The comparison is the ordinary mean of all five block means.

Practice

Five blocksIf block means are 0, 0, 0, 0 and 10, what are their ordinary mean and median?
Show answer
The ordinary mean is 2; the median is zero.
TargetWhy is a raw sample median not always a substitute for median-of-means?
Show answer
It estimates a population median, while median-of-means is designed to estimate the population mean under suitable assumptions. The two targets can differ for skewed data.