Bell Statistics

What is an outlier?

An outlier is an observation far from the rest of the data. Some are errors and some are real, and the distinction matters: a genuine extreme value carries information about your business, while removing it after seeing the results is a way of choosing the answer.

Also called
extreme value, anomaly, influential point
Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

In plain English

An outlier is an observation that sits far from the others. In business data they are usually real: the customer who bought forty units for an office, the account that placed a £40,000 order, the session that lasted nine hours because someone left a tab open. Some are genuine errors — a test transaction, a bot, a duplicated event, a currency recorded in the wrong unit — and separating those two categories is the whole of the problem, because the correct treatment is entirely different.

The reason they matter so much in experimentation is arithmetic. The mean and the variance are both computed from squared deviations, so a single extreme value moves the variance far more than it moves the mean — a value ten standard deviations out contributes a hundred times what a typical one does. On a revenue metric with a long tail, a handful of orders can supply most of the variance, which means they largely determine the width of your confidence interval and therefore whether the test concludes anything at all.

They also break the comparison in a subtler way. If one arm happens to receive the £40,000 order and the other does not, the difference in means reflects that one customer rather than the treatment. This is not a bias — randomisation still holds — but it is enormous variance, and it means a result can flip on a single row. Checking whether the conclusion survives removing the largest few observations is one of the most informative diagnostics available, and it takes a minute.

The rule that keeps this honest is that the handling must be decided before the data are seen. Winsorising at the 99th percentile — replacing values above it with the percentile itself — is the usual choice for revenue metrics, because it keeps every user in the analysis while capping their influence. Trimming removes them entirely, which discards information and changes the population being described. Analysing a log or a rank-based statistic sidesteps the issue by changing the question. All of these are defensible; deciding among them after seeing which one produces significance is not.

Genuine errors are a different matter and should be excluded — but the exclusion rule must be blind to the arm. A filter that drops sessions under five seconds will fire more often on a slower variant, which reintroduces selection bias into a randomised design and can be detected as a sample ratio mismatch. Define exclusions on pre-assignment characteristics where possible, apply them identically to every arm, and check the arm counts afterwards. We work through the practical sequence in tackling outliers in A/B testing.

The formula

Two detection rules and two treatments. The detection rules are guidance for looking, not authority for deleting.

Interquartile range rule
outlier if x < Q₁ − 1.5·IQR or x > Q₃ + 1.5·IQR

What a boxplot draws. Robust, because quartiles are not moved by the extremes themselves — but it flags a large share of any right-skewed revenue distribution.

Z-score rule
|z| = |x − x̄| / s > 3

Poor on skewed data and self-defeating: the outlier inflates s, which raises the threshold that would have caught it. Use the IQR rule or a robust z instead.

Winsorising
x* = min( x, Q₉₉ )

Caps rather than deletes, so every user stays in the analysis with a bounded influence. The default for revenue metrics in experiments.

Effect on variance
a value k SDs out contributes k² to the sum of squares

Which is why a handful of extremes can supply most of the variance — and most of the sample size a test demands. See the Wilcoxon test calculator for the rank-based alternative.

Worked example

An experiment on revenue per user, 60,000 per arm. The variant shows +£0.42 per user, p = 0.03. The analyst checks robustness by recomputing after capping the top 0.1% of orders, and separately after removing the single largest order.

Raw difference
+£0.42, p = 0.03
Largest single order
£41,800 (variant arm)
Its contribution to the difference
£0.70 per user
After removing that one order
−£0.28, p = 0.11
After winsorising at the 99th percentile
+£0.09, p = 0.42
Share of variance from the top 0.1%
31%

One order of £41,800 accounts for more than the entire measured effect. Removing it reverses the sign; capping the tail leaves nothing significant.

The reported win is one customer. That customer is real and their order is real, but a result that flips on a single row is not a finding about the treatment — it is a finding about which arm happened to receive an unusual purchase, which randomisation makes a coin flip. The uncomfortable part is that the correct action was not available at this point: the winsorising rule should have been in the design document, because choosing it now means choosing between +£0.42 significant and +£0.09 not, with the results already visible. The defensible write-up reports both, states that the effect is not robust to a single observation, and commits to winsorising at the 99th percentile for every revenue test going forward.

Common misconceptions

Outliers are errors and should be removed.
Most extreme values in business data are real customers behaving unusually, and they are often the most valuable ones. Removing them changes what you are measuring and can hide exactly the effect a test was meant to find. Errors — test transactions, bots, unit mistakes — should be excluded by a rule that is blind to the experiment arm; real extremes should be capped, not deleted.
We removed the outliers and the result became significant, which is a cleaner analysis.
Choosing a data-handling rule after seeing which one produces significance is choosing the answer, and it invalidates the error rate the p-value claims. Decide the rule in advance and apply it whatever happens. If the choice was made afterwards, the honest report shows both results and says which rule was pre-specified.
A z-score above 3 identifies outliers reliably.
It works on roughly normal data and fails on the skewed distributions where it is most needed. The extreme values themselves inflate the standard deviation, raising the threshold that should have flagged them — so a single enormous value can hide itself. The interquartile rule uses quartiles, which the extremes do not move, and is the better default.

Frequently asked questions

Should I winsorise or remove outliers?
Winsorise for genuine extreme values, because it keeps every user in the analysis while capping how much any one of them can influence the result. Remove only for identified errors — test accounts, bots, duplicated events, unit mistakes — and use a rule that cannot be affected by the treatment. Removing real customers changes the population your estimate describes, and usually removes exactly the high-value behaviour the business cares about most.
Where should I set the winsorising threshold?
The 99th percentile is a common default for revenue metrics and the 99.5th for heavier tails. What matters far more than the exact value is that it is chosen before the results are visible and applied identically to every arm. It is worth checking on historical data how much variance each candidate threshold removes and how much of the metric's total value it caps, then fixing one and using it consistently.
How do I know whether outliers are driving my result?
Recompute the effect with the largest few observations removed, and separately with the tail winsorised. If the conclusion survives all three versions, it is robust. If it flips on one row, the finding is about that row rather than about the treatment — and that check takes a minute and should be routine on any revenue metric, whatever the p-value says.

Related terms

  • Central limit theorem

    Why averages go bell-shaped even when the data do not — the result that makes ordinary tests work.

  • Normal distribution

    The bell curve — and why your skewed revenue data usually does not break the test anyway.

  • Sample ratio mismatch

    The split is wrong, so the randomisation is broken — the cheapest and most decisive check you can run.

  • Selection bias

    When who ends up in the data is not who you meant to study — and more data makes it worse.

  • Standard deviation

    How spread out the data are, in the data's own units — and the reason some metrics need vastly more sample.

  • Variance

    Spread in squared units — awkward to read, and the quantity every sample-size formula is built on.

Calculate it

  • Wilcoxon test

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

  • Two-sample t-test

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

  • Paired t-test

    Before-and-after or matched pairs — size the study on the difference SD, then test it.

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.