Power and Sample Size
By the end of this lesson, you should be able to: name the four quantities that decide how many users a test needs, calculate a sample size, explain why small effects need so many users, turn a sample size into a number of days, and say what goes wrong when a test is too small.
Four quantities, one sample size
The sample size of an experiment comes from four things.
- The significance level (α). How often you accept a false positive when the change does nothing. Usually 5%.
- Power. The chance of detecting a real effect of a given size. Usually 80%, which means a real effect of that size is missed one time in five.
- The minimum detectable effect (MDE). The smallest effect you care about detecting. This is a business decision: how big does a change have to be to be worth shipping?
- The variance of the metric. How much the metric naturally varies between users. A noisy metric needs more users.
For a conversion rate, the number of users needed in each group is:
Here, is the current conversion rate and is the rate you'd see with the smallest effect you care about. With α = 5% and 80% power, the first part, , is about 7.85.
A handy shortcut for any metric: you need about users per group, where σ is the metric's standard deviation and δ is the absolute effect you want to detect.
Why small effects are so expensive
The effect size sits squared at the bottom of the formula. So halving the effect you want to detect means four times as many users, not two.
With a 5% conversion rate, detecting a 10% relative lift (5% to 5.5%) needs about 31,000 users per group. Detecting a 5% lift needs about 122,000. Detecting a 2.5% lift needs about 483,000.