Statistics

Outliers in A/B Testing: When to Cap the Long Tail

Revenue outliers: one customer can invent a 50 percent win per user. How to use metric capping without trading one bias for another.

Flat editorial illustration of one very tall slender column beside many short uniform columns, with a horizontal blade trimming it level and a thin tail of dots to the right

Revenue per user metrics are heavily skewed, and the mean is the most fragile summary you can pick for a distribution like that. A single customer, one revenue outlier, moves an entire arm average by tens of percent with nothing at all having happened to the product. This guide covers a worked example where one corporate buyer invents a 50 percent win single handedly, the rule of thumb published by the Bing team for knowing how many users your metric actually needs, why the power floor and the normality floor are two different floors, how to choose a cap without turning capping into manipulation, and what capping definitely does not fix. It is part of our complete guide to A/B testing and connects directly to ratio metrics and the delta method.

The mean cannot carry your revenue distribution

Conversion rate is a well behaved metric: each user contributes zero or one, variance is bounded, and the central limit theorem arrives quickly. Revenue per user has none of those properties. Most users contribute zero, most buyers contribute little, and a tiny fraction contributes hundreds of times the average.

The size of this is not an impression. Kohavi, Deng, Longbotham and Xu report that at a commerce site the skewness of purchases per customer exceeded 10 and that of revenue per customer exceeded 30. At Bing, revenue per user had a skewness coefficient of 17.9. For comparison, a symmetric distribution has skewness zero, and the authors only invoke their rule of thumb when absolute skewness passes 1.

Typical shape of a revenue per user distributionA histogram where the first bar, users who spent zero, is by far the tallest, followed by bars that fall away quickly and a very long, very low tail to the right. The mean sits to the right of the median, pulled by the tail, and a vertical marker shows where a value cap would be applied, cutting only the extreme end of the tail.medianmeancapset in advancespend per user, increasing to the rightThe amber bar at the far end is a single user. Alone, it moves the mean more than all the pale bars combined.
The mean always sits to the right of the median in a distribution like this, and the distance between them is precisely the leverage the tail holds over your result.

Worked example: one purchase that invents 50 percent

A B2B commerce site runs a test with 60,000 users per arm. Real behavior is identical on both sides: the change under test moved no purchase at all. Each arm accumulates 240,000 in revenue, giving an honest average of 4.0000 per user.

Except one user in arm B is a corporate buyer who placed a single order of 120,000. Not fraud, not a robot, not a bug: a real sale that would have happened anyway.

Arm Users Total revenue Revenue per user
A, control 60,000 240,000 4.0000
B, treatment, with the corporate order 60,000 360,000 6.0000
Measured difference 120,000 plus 2.0000, plus 50.00 percent

A 50 percent win in revenue per user, produced by 1 user out of 120,000. Had the order landed in arm A, the very same experiment would have produced a 33.3 percent loss. The test outcome was decided by a coin flip that has nothing to do with the product.

Now the same experiment with a cap of 200 per user, set in advance and applied equally to both arms:

Arm Capped total revenue Capped revenue per user
A, control 240,000 4.0000
B, treatment 240,200 4.0033
Measured difference plus 0.0033, plus 0.08 percent

The correct reading appeared: no effect. And what happened to the company real revenue? Nothing. The 120,000 hit the bank. What the cap did was stop a sale that would have happened regardless from being credited to a product change.

The same experiment read with and without a value capTwo comparisons side by side. On the left, uncapped: the control bar reads 4 per user and the treatment bar reads 6, a 50 percent difference. On the right, capped at 200 per user: the two bars sit at practically the same height, 4.0000 against 4.0033, a difference of 0.08 percent. User behavior is identical under both readings.UncappedCapped at 200 per user4.0000control6.0000treatmentplus 50.00 percent4.0000control4.0033treatmentplus 0.08 percent
No user behaved differently between the two readings. The 50 percent difference existed only in the sensitivity of the mean to one extreme value.

The Kohavi rule: 355 times skewness squared

If the mean is slow to become normal, the confidence interval your calculator prints is not worth what it claims. The practical question is how many users are enough. Kohavi, Deng, Longbotham and Xu published a direct rule of thumb at KDD 2014, derived from work by Boos and Hughes-Oliver: the minimum number of independent and identically distributed observations for the mean to be approximately normally distributed is 355 times the square of the skewness coefficient, per variant. They recommend applying it whenever absolute skewness exceeds 1.

Here is the table they published with real Bing metrics, alongside what the formula returns when redone by hand:

Bing metric Skewness (absolute) 355 times the square Published sample Sensitivity at 80 percent power
Revenue per user 17.9 113,746 114k 4.4 percent
Revenue per user, capped 5.2 9,599 9.7k 10.5 percent
Sessions per user 3.6 4,601 4.70k 5.4 percent
Time to success 2.1 1,566 1.55k 12.3 percent

The recomputed arithmetic reproduces the published table within the rounding of the skewness coefficient, and the jump between the first two rows is the entire case for capping in a single number: the same metric, capped, needs twelve times fewer users for its mean to be trustworthy.

Minimum sample for normality of the mean by level of skewnessHorizontal bars comparing the minimum sample per variant required by the rule of 355 times skewness squared. Revenue per user with skewness 17.9 requires 113,746 users; the same metric capped, with skewness 5.2, requires 9,599; sessions per user with skewness 3.6 requires 4,601; time to success with skewness 2.1 requires 1,566. The scale is dominated by the first bar, which is exactly the point.Users per variant required just for the mean to be approximately normalrevenue per user113,746capped revenue9,599sessions per user4,601time to success1,566The rule grows with the SQUARE of skewness, so doubling the tail quadruples the sample you need.
Values computed with the rule published by Kohavi, Deng, Longbotham and Xu, using the skewness coefficients from their own table.

Two different floors, and the higher one wins

Here is the confusion that makes teams underestimate test duration. A sample size calculator answers a question about power: how many users to detect an effect of size X. The 355 rule answers a question about validity: how many users for the confidence interval arithmetic to mean anything. They are separate, independent floors, and you have to clear both.

Run the power floor for your binary conversion metric:

Sample size calculator
-Visitors per variation
-Total (2 variations)
-Estimated duration

Two-proportion normal approximation, 2 variations (50/50). Tweak the inputs and watch it update live.

With a 5 percent baseline and a minimum detectable effect of 10 percent relative, at 95 percent confidence and 80 percent power, it returns 31,234 users per variant. If the same test also tracks revenue per user with skewness near 18, the normality floor of that metric alone is 113,746 per variant. The test you thought would take two weeks takes seven, and the metric setting the pace is revenue, not conversion.

Floor What it answers Example Value
Power can I detect the effect I care about 5 percent conversion, 10 percent relative MDE 31,234 per variant
Normality does the confidence interval mean what it says revenue per user, skewness 17.9 113,746 per variant
Decision take the larger of the two 113,746 per variant

Kohavi and colleagues add a cheap recommendation that helps for free: make sure control and treatment are equally sized. With a 50 against 50 split and similar distributions, the distribution of the delta becomes approximately symmetric, and skewness stops being the problem it was. Unequal splits cost more than they look, and checking for them is the subject of sample ratio mismatch.

Choosing a cap without it becoming manipulation

The difference between method and manipulation lives entirely in the procedure, not in the value of the cap.

  1. Choose the cap before the experiment, from historical data, never by looking at the result. Kohavi and colleagues report capping Bing revenue per user at 10 dollars per user per week; skewness fell from about 18 to about 5, and at the same sample size the capped metric could detect a change 30 percent smaller than the uncapped one.
  2. Apply exactly the same cap to both arms. An asymmetric cap is not analysis, it is picking a winner.
  3. Fix a window along with the value. Ten dollars per user per week is not the same as ten dollars per user per experiment. Without a declared window, the same cap silently tightens on longer tests.
  4. Report both metrics. The capped one decides, the raw one accompanies. When the two disagree in a large and persistent way, that is information: it means the effect is concentrated in the tail, and the business decision may differ from the statistical one.
  5. Say which question you are answering. The capped metric speaks about the typical customer. It does not speak about total company revenue, and presenting it as if it did is the only real way to lie with capping.

One alternative to a hard cap, when the tail is the product rather than the noise: instead of limiting, reduce variance another way. CUPED uses pre-experiment data to strip out variation that has nothing to do with the treatment and usually buys sensitivity without touching a single observed value.

What capping does not fix

A cap is a tool against legitimate extreme values. It is not, and does not replace, cleaning dirty data.

A robot still has to be handled as a robot. Crook, Frasca, Kohavi and Longbotham draw the distinction carefully in their KDD 2009 paper: if robot traffic is distributed across variants in an unbiased way, it adds noise and reduces the power of the experiment but does not invalidate the results; a robot seen as multiple unique users because it resets cookies or runs from several machines introduces no bias either. The dangerous case is the robot acting as a single user that consistently generates traffic for one variant, because it can make that variant statistically better without any human having preferred anything. They report a case on the MSN portal where robots accepted cookies and executed JavaScript, firing click events at roughly 100 per minute for 2.5 hours.

A measurement defect stays a defect. If the difference comes from how much of the behavior got recorded rather than from the behavior, no cap will help. That is the subject of instrumentation bias, and the classic symptom is an unbalanced pre-trigger metric.

An effect concentrated in the tail does not vanish because you cut it. If your product change genuinely makes large customers buy more, the cap will hide exactly the effect that matters. The answer there is not to remove the cap mid test, it is to declare a second metric in advance, for instance revenue among large accounts, and size the test for it.

Outlier checklist before looking at the mean

  1. What is the skewness of my primary metric? Above 1, the 355 rule applies and probably changes your duration estimate.
  2. Have robots, internal tests and monitoring traffic already been removed? That comes before any capping decision.
  3. Was the cap set in advance, with a window, and does it apply to both arms?
  4. Do the raw and capped metrics tell the same story? A large divergence is information, not an annoyance.
  5. Is the split 50 against 50? It is the cheapest correction available for skewness.
  6. Was the higher of the two floors respected? Power and normality are separate requirements.
  7. Can a single user flip the decision? If so you do not have a result, you have a coin flip. Recompute each arm mean without its largest value and see whether the conclusion survives.

Common mistakes

Make this automatic with Donnu

The outlier problem is not mathematical, it is sequential: the capping decision is almost always made after someone has seen a strange number, and at that point it is no longer a neutral decision.

In Donnu, a revenue metric arrives with its skewness computed and with the 355 rule normality floor shown next to the power floor, so the duration estimate is born from the larger of the two. The cap is a field in the experiment design, filled in before the run and recorded in the history, and the report always shows the raw and capped metrics side by side, with a warning when they disagree. If you want to redo the duration arithmetic yourself, the sample size calculator and the test duration calculator take your own numbers.

References

Read next: Ratio metrics and the delta method · What is CUPED · Instrumentation bias · Guardrail metrics · Sample size calculator · Leia em português

Frequently asked questions

What is metric capping in A/B testing?
It is limiting the maximum value a single user can contribute to a metric before the average is computed. Kohavi, Deng, Longbotham and Xu report capping revenue per user at Bing to 10 dollars per user per week; the skewness of the metric fell from about 18 to about 5 and, at the same sample size, capped revenue per user could detect a change 30 percent smaller than the uncapped version. The cap has to be decided before the experiment and applied identically to both arms.
How many users does a revenue metric need?
More than the power calculation suggests. The rule of thumb published by Kohavi, Deng, Longbotham and Xu at KDD 2014 is 355 times the square of the skewness coefficient per variant, and they recommend using it whenever the absolute skewness exceeds 1. For Bing revenue per user, with skewness 17.9, that comes to roughly 114 thousand users per arm just for the mean to be approximately normal, before any consideration of statistical power.
Is capping just massaging the result?
It is massaging when the cap is chosen after seeing the data, or applied to one arm only, or adjusted until the number looks good. It is not massaging when the cap is set before the experiment from pre-experiment data, applied equally to both arms, documented, and reported alongside the uncapped metric. What genuinely changes is the question being answered: the capped metric speaks about the typical customer, not about total revenue, and that has to be stated.
Does a robot ruin the revenue average of an experiment?
It depends how it distributes. Crook, Frasca, Kohavi and Longbotham are precise about this: robot traffic spread across variants in an unbiased way adds noise and reduces the power of the experiment but does not invalidate results; a robot that resets cookies or runs from multiple machines shows up as multiple users and creates no bias either. The dangerous case is the robot that acts as a single user and consistently generates traffic for one variant, because then it can make that variant statistically better without any human having preferred anything.
What is the difference between an outlier and a legitimate long tail?
An outlier is a value that should not be in the dataset at all: a robot, an internal test, an instrumentation error, a duplicated order. A legitimate long tail is the real corporate customer who genuinely spent thirty thousand. The first should be removed, and removing it is the correct decision. The second should not be removed, because it is real company revenue; what you do instead is limit its leverage over the average, accepting that the capped metric answers a slightly different question.