Bell Statistics

What is winsorization?

Winsorization replaces values above a chosen threshold with the threshold itself, so extreme observations are pulled in rather than removed. It cuts the variance a heavy tail contributes while keeping every user in the analysis.

Also called
capping, outlier capping, clipping, trimming, outlier handling
Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

In plain English

Revenue metrics have a shape that makes them difficult: most users contribute nothing or very little, and a handful contribute enormously. One customer spending £40,000 can shift a group mean further than the treatment did, so which arm they happened to land in decides the experiment. Winsorization addresses this by capping — every value above the 99th percentile, say, is replaced by the value at the 99th percentile. The extreme users stay in the analysis and stop dominating it.

The distinction from trimming matters. Trimming deletes the extreme observations entirely, which changes the population being analysed and breaks the randomisation if the number deleted differs between arms. Winsorization keeps every unit and only compresses their values, so the two arms still contain the same people they were assigned. That is why it is the safer default for experiment analysis, and why the terms should not be used interchangeably despite often being treated as synonyms.

The variance reduction is typically large because variance weights squared deviations — an observation ten times the mean contributes a hundred times as much as one at the mean. Capping at the 99th percentile affects one per cent of users and routinely removes 40 to 60 per cent of the variance of a revenue metric, which by the quadratic sample-size relationship means less than half the traffic for the same minimum detectable effect. Few interventions in experimentation are that cheap.

The single rule that makes it legitimate is that the threshold is fixed before the results are seen. A cap chosen after looking at the data is not a statistical method; it is a choice about which answer to obtain, and with a heavy-tailed metric the answer genuinely does move as the threshold slides. Pick the percentile from historical data, write it into the analysis plan alongside the sample size calculation, and apply it identically to both arms.

What it costs is honesty about the question. A winsorized revenue metric is no longer total revenue — it is revenue with the top tail compressed, and a treatment whose entire effect is on whales will be invisible under it. For most product changes that is an acceptable trade, because a result that depends on three customers was never reliable evidence anyway. When the tail genuinely is the business, the alternatives are a rank-based test such as Mann-Whitney or accepting that the metric needs far more traffic.

The formula

One substitution rule, plus the variance identity that explains why capping so few observations changes the answer so much.

The transformation
x' = min( x, q_p )

q_p is the value at percentile p, computed on the pooled data across arms so the cap is identical in both.

Two-sided version
x' = min( max( x, q_low ), q_high )

Rarely needed for revenue, which has a floor at zero. Useful for metrics like latency deltas that run both ways.

Why it works so hard
Var = E[ ( x − μ )² ]

Squared deviations. A value 10× the mean contributes 100× as much variance as one at the mean.

What it buys
n ∝ σ², so halving variance halves required traffic

Capping at p99 typically removes 40-60% of a revenue metric's variance — see the two-sample t-test calculator.

Worked example

A marketplace analyses a checkout test on revenue per user across 120,000 users per arm. The raw metric is dominated by a small number of very large orders, and the team wants to know what capping at various percentiles would do — and, critically, they compute this on last quarter's data before the experiment reads out.

Uncapped
mean £18.40, SD £212.60, CV = 11.6
Capped at p99.9 (£4,100)
SD £148.20, CV = 8.1
Capped at p99 (£980)
SD £96.40, CV = 5.3
Capped at p95 (£310)
SD £54.80, CV = 3.0
Users affected at p99
1,200 of 120,000
Revenue represented by those users
22% of the total

Capping at the 99th percentile touches 1% of users, halves the standard deviation, and cuts the required sample by roughly a factor of four.

The last row is the one that requires a decision rather than a calculation. Those 1,200 users carry 22% of all revenue, so capping them is not a cosmetic adjustment — it materially changes what the metric measures, and a treatment that works mainly by increasing large orders would be invisible under a p99 cap. For a checkout usability change that is almost certainly fine, since such a change should affect the ordinary customer and any result resting on a handful of whales would not have been trustworthy. For a test of a new enterprise pricing tier it would be exactly wrong. The p95 column is included to show where this stops being reasonable: capping 5% of users compresses too much of the real distribution to still be called revenue. The defensible choice here is p99, decided now, applied to both arms, and reported explicitly as a capped metric.

Common misconceptions

Winsorization and trimming are two words for the same thing.
Trimming deletes the extreme observations; winsorization replaces their values with a threshold and keeps the units. That difference matters in an experiment, because deleting different numbers of users from each arm breaks the randomisation that the whole comparison depends on. Winsorization keeps both arms containing exactly the people assigned to them.
Choosing the cap after seeing the data is fine as long as it looks sensible.
With a heavy-tailed metric the result genuinely moves as the threshold slides, so a post-hoc cap is a choice about which answer to report. There is usually no way for a reader to detect this from the output. The threshold has to be fixed in advance from historical data and written down with the analysis plan.
Capping throws away real revenue, so it distorts the business picture.
It changes the metric, deliberately, and the capped metric should be reported as such. What it protects against is a conclusion resting on two or three customers, which was never evidence about the treatment. Report the uncapped totals for business reporting and use the capped metric for the statistical decision — they serve different purposes.

Frequently asked questions

Which percentile should I cap at?
The 99th is the common default for revenue metrics and usually a good starting point: it affects one per cent of users and removes most of the variance. Look at the histogram on historical data before committing — if the top 0.1% is orders of magnitude above the rest, cap higher; if the distribution is only moderately skewed, capping may not be worth the interpretive cost. Whatever you choose, choose it before the results exist.
Should I cap and run a t-test, or use a rank-based test instead?
Capping is usually preferable when the business question is about totals, because the answer stays in currency and most magnitude information survives. A rank test avoids the threshold decision entirely but answers a different question — whether a typical user does better, not whether revenue rose. Running both is a useful cross-check: agreement means the conclusion is not an artefact of either choice.
Should the cap be computed separately for each arm?
No — compute it once on the pooled data and apply the same threshold to both. Per-arm thresholds mean the two arms are transformed differently, which introduces exactly the asymmetry the transformation was meant to remove, and a treatment that shifts the tail would move its own cap. One threshold, computed on the pooled distribution or on a historical baseline, applied identically.
Can I use winsorization and CUPED together?
Yes, and they compose well because they remove different noise — CUPED strips out the part predictable from a user's history, capping removes the leverage of extreme values. Apply the cap first, then compute the CUPED adjustment on the capped metric, so the covariate relationship is estimated on the same scale that will be analysed. The combined reduction is usually substantially better than either alone.

Related terms

  • Mann-Whitney U test

    Compares by rank instead of by mean, so one whale cannot move the result — and answers a subtly different question.

  • Metric sensitivity

    Whether the number can move at all in the time you have — the property that decides which metrics are usable.

  • Outlier

    The extreme value that decides your result — and why the rule for handling it must precede the data.

  • Stratified randomization

    Balance the mix before you randomise instead of correcting for it afterwards — cheap insurance, modest at scale.

Calculate it

  • Two-sample t-test

    Compare the average of two independent groups — plan the sample size, then test the result.

  • Wilcoxon test

    Rank-sum (Mann-Whitney) and signed-rank tests, with the exact distribution for small samples.

Knowing the term is the easy part

Applying it to a live measurement problem is the part that goes wrong. If you are designing an experiment, reading a result you do not trust, or trying to work out what your marketing actually caused, that is the work we do.

References