06

How many people, and for how long

A test needs enough people and enough time, and they are not the same thing. The honest question is not “what lift do I expect?” but “what is the smallest change worth knowing about?”

Two numbers decide every test. The sample size is how many people take part: it sets how precise the answer is. The duration is how long the test runs: it sets whether the people in it look like all your customers, the Monday-morning ones and the Saturday-night ones, the quick buyers and the slow deciders. A test can have plenty of people and still be too short, if they all came from one kind of day. This chapter covers both: first how many, then how long.

Both rest on noise, the wobble between groups that chance alone produces (chapter 4). Its size depends on two things: how variable the behaviour is, and how many people you watch. You cannot change the first much. The second is the first half of this chapter.

Start from the decision, not the hope

Before a test, teams usually guess the lift they expect, and the guess is usually optimistic: people who propose an idea believe in it, as chapter 2 showed.

Sizing a test on hope produces tests that are too small to see the effects that actually happen.

The minimum detectable effect

A better question is: what is the smallest change that would be worth acting on? That number is the minimum detectable effect, the MDE. It is a business decision dressed as a statistical one, and it is the input that moves the answer most.

Working it out

Take a shop with 200,000 visitors a week, a 4% conversion rate and an average order of €60. That is 8,000 orders a week. A 1% relative improvement, from 4.00% to 4.04%, is 80 more orders a week, about €4,800, or roughly €250,000 a year. A 5% improvement is five times that.

Now the other side: what does the change cost? Design and build time, the complexity added to the product, the maintenance for years to come, the other ideas the team did not build meanwhile. If the redesign took a team three months, a 1% gain may well pay for it. If it adds a fragile dependency everyone will curse, you may want 5% before keeping it.

Then check what you can afford to measure. With this traffic, to see 5% takes about 154,000 visitors per version; to see 2%, about 950,000; to see 1%, about 3.8 million.

Weeks to run, by the smallest effect worth seeing

How to read itEach bar is how many weeks the shop above, with 200,000 visitors a week, needs to run a test that catches an improvement of that size four times in five.

  1. To see 5%2 weeks
  2. To see 2%10 weeks
  3. To see 1%38 weeks
What it showsHalving the effect you want to see roughly quadruples the time. Five percent fits in two weeks; one percent would take most of a year.

So a change worth €250,000 a year may be invisible to any test you can realistically run. That is not a statistical failure; it is information. You can test a bolder version with a bigger expected effect, find a metric closer to the change (chapter 5) or with less noise (chapter 10), or accept that this decision will be made without a test, as the end of this chapter discusses.

For a mature e-commerce site Ron Kohavi suggests 5% relative as a sensible default MDE when you have nothing better. Whatever you choose, choose it before the test, and write down why.

Power: the chance of seeing what is there

Suppose your change really does improve conversion by exactly your MDE.

Because of noise, a test will not always show it. Power is the share of such tests that would come out significant. The convention is 80%, which means that one real improvement in five is missed even when the test is sized correctly.

Significance and power are two different promises. The significance level α limits how often you declare a win when nothing happened. Power limits how often you miss a win that did happen. A test needs both, and both cost people.

Where the number of people comes from

The sizes above follow from chapter 4 in three steps. A result counts as significant when the measured difference lands at least 1.96 standard errors from zero. If the true effect sits 2.80 standard errors from zero, the measured difference wobbles around 2.80 in a bell shape, and lands beyond 1.96 four times in five: 1.96 is 0.84 standard errors below the centre, and 80% of a bell lies above that point. So a test has 80% power for the MDE when the MDE equals 2.80 standard errors. Note what this does not mean: the MDE is what the test is sized to detect, not a pass mark for the measured number. A measured lift below the MDE can be significant, and one above it can be noise (chapter 9). The standard error shrinks with the square root of the number of people, so the number of people follows: in the shop, 154,000 per version makes the standard error of a 5% lift 1.79% (relative), and 2.80 × 1.79% = 5%.

The maths

For two groups of n users each, with per-user variances σ²A and σ²B, the standard error of the difference is √((σ²A + σ²B)/n). Requiring the true difference δ to sit z1−α/2 + z1−β standard errors from zero (1.96 + 0.84 = 2.80 at α = 0.05 and 80% power), and solving for n, a two-sided test needs

n=(z1−α/2+z1−β)2(σA2+σB2)δ2
Slowly, with numbers

In wordsHow far apart the two bells must be, squared, times how much one visitor varies, divided by the square of the difference you want to see.

n
The people needed in each version.
δ
Delta: the smallest difference worth detecting, as an absolute number. 5% of a 4% rate is 0.002.
σ²A, σ²B
How much one visitor varies in each group. For a rate it is the rate times one minus the rate: 0.04 × 0.96 = 0.0384 and 0.042 × 0.958 = 0.0402.
z1−α/2
An awkward name for 1.96: the point that leaves α/2 = 2.5% of the bell beyond it.
z1−β
The same idea for power: 0.84 is the point with 80% of the bell below it.

With numbers1.96 + 0.84 = 2.80, squared 7.85. Times 0.0384 + 0.0402 = 0.0786, that is 0.617. Divided by 0.002² = 0.000004: about 154,000 per version.

Why 2.80? Picture the two bells of chapter 4: “no change” centred on zero, “a real improvement” centred on δ. The line for a win sits 1.96 standard errors right of zero. For 80% of the second bell to be beyond that line, its centre must be another 0.84 further out.

With α = 0.05 and 80% power, (1.96 + 0.84)² ≈ 7.85, and with σ²A ≈ σ²B the formula collapses to Kohavi’s rule of thumb:

n≈16σ2δ2
With numbers

16 × 0.0384 / 0.000004 = 153,600: the same answer to within half a percent, and easy to do on a phone. Halve δ to 0.001 and the bottom becomes 0.000001: four times the people.

For a rate p, σ² = p(1 − p). Note δ² in the denominator: halve the effect, quadruple the users.

Size a test yourself

The planner below does the arithmetic of this chapter with your own numbers.

How many people, and how many weeks

How to read itSet three things you know before a test: today’s conversion rate, the smallest lift worth shipping (a relative change: 5% of 4% takes it to 4.20%), and your weekly traffic. The answer is how many people each version needs, and how many whole weeks that takes. Try halving the lift and watch the people needed roughly quadruple.

Conversion today4%
Lift worth shipping5%
Visitors a week200,000
people in each version
—
with your traffic
—

At a 4% baseline, finding a 5% relative change (4.0% to 4.2%) takes about 154,000 users per variant. Finding a 10% change takes about 39,000. Finding a 2% change takes about 950,000. The relationship is not linear and it is not forgiving: every halving of the effect you want to see multiplies the cost by four.

The full planner adds what this sketch leaves out: averages as well as rates, several variants, variance reduction, sequential looks and the week-by-week trade-off.

Small tests do not just miss. They lie.

The obvious cost of an underpowered test is that it misses real effects. The less obvious cost is worse. When a small test does come out significant, the effect it reports is exaggerated.

Here is why. In a small test the noise is large compared with the true effect. The only way such a test reaches significance is when the noise happens to push the estimate far above the truth. So the significant results from small tests are, by construction, the lucky overestimates.

A concrete case makes it clearer. Suppose your new design really does improve conversion by 5%, from 4.0% to 4.2%. You test it on 11,000 visitors per version: it sounds like plenty, it is a typical size for a test on a modest site, and it is about fourteen times fewer than the 154,000 per version this effect needs. Now imagine running that same test many times and looking at the ones that come out significant.

That test comes out significant about one time in nine, and when it does, it reports a lift of about 16%.

Most of the time the real improvement goes unnoticed. The few times the test does declare a win, it announces an effect three times bigger than the truth, and the team plans next year’s revenue around a number that will never appear.

Where those numbers come from

Baseline 4%, true lift 5% (δ = 0.002), n = 11,000 per variant: the standard error of the difference is about 0.0027, so δ/SE ≈ 0.75. Two-sided power is Φ(0.75 − 1.96) + Φ(−0.75 − 1.96) ≈ 11.6%: about one time in nine. The upper tail alone, the tests that are significant and positive, is 11.3%, and that is what the simulation below keeps.

Slowly, with numbers

In wordsThe same two bells, but now the test is far too small, so the bell of the real improvement is centred only 0.75 standard errors from zero instead of 2.80. Most of it lies short of the line at 1.96.

Φ
Capital phi, the lookup from chapter 4: the share of a bell curve to the left of a point.
Φ(0.75 − 1.96)
Φ(−1.21) = 0.113: the share of the improvement’s bell that reaches beyond +1.96. These are the tests that find it.
Φ(−0.75 − 1.96)
Φ(−2.71) = 0.003: the sliver that falls beyond −1.96, significant in the wrong direction.

With numbers0.113 + 0.003 = 0.116: the test finds its effect about one time in nine. And the tests that do find it are the ones where luck pushed the measurement far above the truth, which is why their average is 16% and not 5%.

Simulating 200,000 such tests and keeping only those with z > 1.96, the average reported lift is 16.3%, more than three times the truth. Gelman and Carlin call this a type M (magnitude) error; practitioners call it the winner’s curse. A few of the significant tests even point the wrong way: a type S (sign) error.

This is the mechanism behind most of the dramatic case studies shared at conferences: a 30% lift from a button colour on a site with modest traffic. The test was real; the number was a lucky draw from a noisy one. Chapter 14 has documented examples, a testing vendor’s own case study among them.

How long: whole business cycles

The sample size tells you how many people you need.

It does not tell you which people. If you could get all of them in one afternoon, you would have the number, and a very odd sample: only the people who shop on that kind of afternoon. A test has to run long enough for its people to be a fair picture of everyone who uses the product. Statisticians call that being representative.

What makes people different over time is the rhythm of their lives. Behaviour that repeats on a schedule is a business cycle, and every product has some:

The week is the cycle that matters most because it is the shortest one that almost always changes who shows up. A test that covers ten days has counted some weekdays twice and others once, so its result is tilted towards whatever those days are like. The rule is to run whole weeks: one at the very least, two to be safer, which also leaves room to see effects that fade as the novelty wears off (chapter 8). If people take weeks to decide, run long enough for the slow deciders to show up.

Once you know the number of visitors you need, divide by weekly traffic and round up to whole weeks. If the people arrive faster than that, keep the test running anyway: you have the number, not yet the mix. Decide the duration before you start and write it down. A test stopped the moment it looks good, or extended because it does not look good yet, has quietly changed its own rules. The chapter on looking early shows how much that costs, and how to look early properly.

Seasons are a different thing

Seasonality is the slow rhythm of the year: summer holidays, the run-up to Christmas, sales periods, the start of the school year. It is not something a test averages over. A two-week test runs inside one season, and its result is a result for that season: a change that wins in the quiet weeks of February may behave differently in the December rush, when the people and their hurry are different.

Two consequences follow. First, do not run a test across a turning point, the week a sale starts, the holidays begin or a big campaign launches. The people before and after the switch are different crowds, and the result mixes them in proportions nobody chose. Wait for the season to settle, or plan the test entirely inside it. Second, if the decision matters most in a particular season, test in that season, or re-check the winner when it comes round.

Three ways to need fewer people

If the answer is too many people, there are three levers, and the first one is in the designer’s hands.

The first of the three is a design decision. Here is what it looks like on a page.

The same idea, quiet and loud

How to read itWireframes of a product page. The idea is to tell people that delivery is free; the message is drawn in blue. The numbers are for the shop in this chapter: 200,000 visitors a week, 4% of them buying.

€48Add to basket★★★★☆ 212 reviews
Atoday: no message
€48Free deliveryAdd to basket★★★★☆ 212 reviews
B, quieta line under the price. To detect 1%: 3.8 million per version, 38 weeks
Free delivery on every order€48Add to basket★★★★☆ 212 reviews
B, louda bar fixed to the top. To detect 5%: 154,000 per version, 2 weeks
What it showsA change few people notice can only have a small effect, and a small effect needs a very large test. The loud version can have a larger one, so it can be tested in two weeks instead of most of a year. If even the bar moves nothing, the line would not have either.

And one way to need more: more variants. Every extra variant shares the traffic and, to keep the overall error rate, needs a stricter threshold: with three variants, the 5% is divided by three (the Bonferroni correction of chapter 4). Three variants against control at a 5% MDE then need about 206,000 users each instead of 154,000, in four groups instead of two: about 2.7 times the people of a plain A/B test.

When a test cannot answer

Sometimes the planner comes back with forty weeks. Sometimes the change cannot be split at random at all.

It is tempting to run a test anyway, small and short, and hope. Or to hand the data to an analyst and ask for an answer by Friday. Both produce a number. Neither produces knowledge: an underpowered test gives exaggerated wins and meaningless nulls, as this chapter showed, and squeezing data for an answer it does not contain only produces a more confident wrong one. As the economist Ronald Coase is often quoted as saying, if you torture the data long enough, it will confess.

Situations where a controlled experiment often cannot settle the question:

Being data-driven includes knowing when the data cannot answer.

In those cases the honest move is to decide without a test, and say so. Use the best evidence you have: research with users, what similar changes did before, what other companies have published, observational data read carefully. Kohavi, Tang and Xu describe these complementary and observational methods, and their limits, in their book. Write down what you expect to happen, launch, watch the metrics that would tell you if you were badly wrong, and be ready to reverse. A decision made openly with weak evidence is better than one disguised as a test result.

If you have little traffic

The advice for small sites is scattered across this book. In one place, in the order to try it:

  1. Test bigger changes. A bold version you would still ship has a larger effect, and the people needed fall with its square.
  2. Measure closer to the change. A metric on the page you changed moves more than one at the end of the funnel (chapter 5).
  3. Decide on a rate, not an amount, and cap extreme values (chapter 10).
  4. Count only who could notice: triggering can make a test several times cheaper (chapter 5).
  5. Use the past: if people come back, CUPED can cut the sample by a quarter to a half (chapter 10).
  6. Test one variant at a time. Every extra one costs a whole group and a stricter threshold.
  7. Check the instrument anyway. A few tests of two identical versions, A/A tests, catch a broken split even when they cannot certify the statistics (chapter 8).

If the planner still says months, stop pretending: decide without a test, openly, as the section above describes. A small test run anyway does not give a weaker answer; it gives a wrong one, with confidence.

What we’ve learned

  • Every comparison wobbles by chance; more people make the wobble smaller.
  • Start from the smallest change worth shipping, not the change you hope for.
  • Halving the effect you want to see multiplies the people you need by four.
  • Small tests miss real effects, and their wins are exaggerated.
  • Sample size sets precision; duration makes the sample representative. Run whole weeks, decided before you start.
  • Do not run a test across a seasonal turning point; a result holds for the season it was measured in.
  • Sometimes a test cannot answer the question; deciding without one is then the honest choice.

Sources

  • Kohavi, R., Tang, D. and Xu, Y. (2020). Trustworthy Online Controlled Experiments. Cambridge University Press. The 16σ²/δ² rule of thumb and full-week durations.
  • Kohavi, R. (2023). When Not to Trust a Published A/B Test – an Example. The 5% default MDE and an underpowered published case.
  • Kohavi, R., Deng, A. and Vermeer, L. (2022). A/B Testing Intuition Busters. KDD 2022. On type M errors in published tests.
  • Kohavi, R., Tang, D. and Xu, Y. (2020). Trustworthy Online Controlled Experiments. Part III, Complementary and Alternative Techniques to Controlled Experiments; chapter 11, Observational Causal Studies.
  • Overgoor, J. (2014). Experiments at Airbnb. Airbnb Engineering.
  • Gelman, A. and Carlin, J. (2014). Beyond Power Calculations: Assessing Type S (Sign) and Type M (Magnitude) Errors. Perspectives on Psychological Science 9(6).
  • Georgiev, G. Z. (2019). Statistical Methods in Online A/B Testing. On power and MDE as design choices.
  • Deng, A., Xu, Y., Kohavi, R. and Walker, T. (2013). Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-Experiment Data. WSDM 2013.