10

Less noise, same people

You cannot always get more visitors. You can often make each one count for more, by removing the part of the noise you could have predicted before the test began.

Chapter 6 showed that the people you need grow with the variance of your metric, the square of its standard deviation (chapter 4). Halve the variance and you halve the sample, or detect a smaller change in the same time. So the cheapest way to speed up a testing programme is often not more traffic but less noise.

Most noise is predictable

Take spend per visitor. Some people spend a lot every month, most spend a little, many spend nothing.

In a two-week test, a large part of the difference between any two visitors is simply who they already were. A few big spenders landing in one group by chance can swamp the effect of your change.

But you know who they already were. You have their behaviour from before the test. If you subtract the part of each person’s result that their own history predicts, what remains is much less noisy, and the change you made is still in there, untouched, because the history was recorded before anyone saw a variant.

If last month predicts this month well, a test can need half the people, or fewer.

CUPED

An everyday comparison first. You want to know whether a new training plan makes runners faster.

You could compare the race times of a group on the new plan with a group on the old one. But runners differ enormously: some run a marathon in under three hours, some in five. That natural spread swamps the effect of any training plan. A smarter comparison is each runner’s improvement on their own previous time. Whatever made a runner fast or slow before the plan started is subtracted out, and what is left is much closer to the effect of the plan.

CUPED does the same for an experiment. For each person it looks at how they behaved in the weeks before the test, works out how much of their behaviour during the test that history predicts, and subtracts it. (The runners subtract all of their old time; CUPED subtracts only the share that the past actually predicts, worked out from the data, which is never more noisy than subtracting nothing.) Big spenders are still big spenders, but now the test compares how each person did relative to what was expected of them, which varies far less from person to person.

The name stands for Controlled-experiment Using Pre-Experiment Data. It was published by Alex Deng, Ya Xu, Ron Kohavi and Toby Walker at Microsoft in 2013, and is now standard in mature experimentation platforms; Spotify and Datadog, among others, document it in their own tools. How much it helps depends on one number: how well people’s past predicts their present.

That number is the correlation between each person’s past and present behaviour, from 0 to 1. At 0, the past tells you nothing. At 1, everyone does exactly what they did before. At 0.5, people who spent more than average before tend to spend more than average during the test, but loosely; knowing their past removes a quarter of the person-to-person spread, because the share removed is the correlation squared.

How much the past saves you

How to read itThe slider is the correlation between what each person spent before the test and what they spend during it. At 0, the past tells you nothing about the present; at 1, everyone spends exactly what they spent before. You measure it on your own data: take each customer’s spend in two past periods, each as long as the test, and compute the correlation between the two columns (in a spreadsheet, the CORREL function). The numbers show how many visitors each version needs without the adjustment and with it; the bar shrinks to the share you still need.

Correlation, past spend with spend during the test0.50
Visitors per version without it
—
With it
—
Saved
—
Revenue per visitor in the example shop of this chapter: 4% of visitors buy, orders average €60 with a standard deviation of €80, so €2.40 per visitor with a standard deviation of about €19.90. Smallest change worth finding 5%. The bar is the sample you still need. The saving is the correlation squared: 0.5 saves a quarter, 0.7 saves about half.
The maths

For each user, with outcome Y during the test and covariate X from before it:

Ycuped=Y−θ(X−X¯) θ=Cov(Y,X)Var(X)
Slowly, with numbers

In wordsFrom each user’s result, subtract a share of how unusual that user already was before the test.

Y
What the user did during the test: say, their spend this month.
X
The same thing for the same user before the test: their spend last month.
X̄
X with a bar: the average of X over all users, both groups together.
θ
Theta: how many euros of this month go with one extra euro of last month. The slope of the line through the cloud of users.
Cov, Var
Covariance and variance, the two quantities that slope is made of. Any spreadsheet has both.

With numbersAverage spend last month €10, and θ = 0.5. A user who spent €40 last month is €30 above average, so 0.5 × 30 = €15 comes off their figure for this month. A user who spent nothing is €10 below, so €5 is added. Big spenders are pulled down and non-spenders pushed up, both towards the middle, so users differ less from each other. The gap between the two groups stays where it was, because both are corrected in the same way.

The adjusted metric has the same expected difference between groups, because X cannot be affected by the treatment, and variance

Var(Ycuped)=Var(Y)(1−ρ2)
Slowly, with numbers
ρ
Rho: the correlation between last month and this month, from 0 (unrelated) to 1 (identical).
1 − ρ²
The share of the noise that is left.

With numbersρ = 0.5: 1 − 0.25 = 0.75, a quarter of the noise gone, so a quarter fewer people for the same test. ρ = 0.7: 1 − 0.49 = 0.51, about half. Products people use every week have high ρ; a shop people visit once a year has almost none.

with ρ the correlation between X and Y. Estimate θ on both groups pooled. In the planner this is the “variance explained by pre-test data” field, ρ².

The one rule that keeps it honest

The adjustment is only unbiased if the variable you adjust for could not have been changed by the experiment.

Behaviour before the test qualifies. Anything measured during the test does not, however tempting: if your change makes people browse more, adjusting for browsing removes part of the very effect you are trying to measure. New users have no history, so for them CUPED does nothing; it helps most on products where people come back. It works for rates as well as amounts, using whether each person converted before the test; the saving is usually smaller, because yes-or-no behaviour repeats less faithfully than spending.

Other ways to cut noise

CUPED is the most powerful tool, but not the only one.

Each of the following can cut the people a test needs by a fifth, a half, sometimes more, and none of them needs new traffic. The numbers below use one example shop throughout: 4% of visitors buy, the average order is €60, and order values vary a lot (a standard deviation of €80, with a long tail of big baskets).

Prefer rates to amounts

Our recommendation: decide on a rate, watch the amount.

When a yes-or-no metric and an amount capture the same success, make the yes-or-no one the deciding metric. Whether someone bought is far less noisy than how much they spent, because the amount carries two kinds of randomness: who buys, and how big their basket happens to be.

In the example shop, detecting a 5% improvement needs about 154,000 visitors per version if you decide on conversion rate, and about 430,000 if you decide on revenue per visitor: 2.8 times as many people for the same question. Some more examples of the same choice:

The amount still matters; you do not want more people buying smaller baskets. Keep it as a guardrail with a threshold, so the test can be decided on the rate without hiding a fall in value.

Cap extreme values

One customer buying a hundred tickets for a school trip can decide a test on their own. Capping, also called winsorising, sets a ceiling on each person’s value, typically at a high percentile such as the 99th, decided before the test. In the example shop, if order values follow a log-normal curve, the usual shape for spend with that average and spread, capping orders at the 99th percentile (about €380) cuts the visitors needed for revenue per visitor by about a fifth, from 430,000 to 350,000. The price is a small bias: the capped metric slightly understates changes that only affect the biggest spenders.

One order that outweighs fifty

How to read itWireframes of two orders in the same shop. The unusual one is drawn in blue.

Your order2 ticketsTotal€60Pay
A typical order2 tickets, €60
Your order100 ticketsTotal€3,000Pay
The school trip100 tickets, €3,000: as much as fifty typical orders
What it showsWhichever group this customer lands in gets €3,000 that has nothing to do with the design. Capped at €378, the order still counts as a very large one, but it can no longer decide the test on its own.

Triggering cuts noise too

Chapter 5’s triggering is also a noise-reduction tool. A change to the payment page, analysed over everyone, carries the random behaviour of every visitor who never reached payment. Counting only the people who reached it, in both groups, can make a test several times cheaper. Examples: a new filter, analysed for people who used filters; a new onboarding step, for new sign-ups only; a change to the app’s settings page, for people who opened settings.

Choose metrics that respond

Some metrics move reliably in short tests; others barely ever do. Clicks on a feature move quickly; yearly retention almost never moves in two weeks. Part of metric development (chapter 13) is measuring, on past experiments, which metrics actually respond to changes, and promoting those to decide tests, with slower goal metrics watched over longer periods.

In practice

Three habits that make noise reduction trustworthy.

What we’ve learned

  • Halving a metric’s variance halves the people a test needs (halving its standard deviation quarters them).
  • Behaviour before the test predicts behaviour during it; removing that part (CUPED) cuts noise without bias.
  • Only adjust for things the experiment could not have changed.
  • Cap extreme values, prefer rates to amounts, and count only who could notice.

Sources