A/B testing: how apps decide with statistics
When two friends see a slightly different YouTube thumbnail or app button. You're probably in dozens of experiments right now.
What problem does it solve?
If version B gets more clicks than version A, is it really better, or just lucky?
The big idea
Randomly split users into two groups, show each a different version, and compare. Randomness is the hero: it makes the groups alike in every other way on average, so a difference in results must come from the change, or from chance. Statistics measures how big a gap chance alone usually produces; only gaps much bigger than that count. A p-value of 0.05 means 'if there were truly no difference, a gap at least this big would show up only 5% of the time', not 'there's a 95% chance B is better'.
How it works, step by step
- 1. Decide in advance what you'll measure and how many users you need.
- 2. Randomly assign each user to A or B.
- 3. Measure each group's rate, e.g. the fraction who clicked.
- 4. Compute z: the gap divided by the size of gap that chance usually produces.
- 5. Only if |z| is large (about 2 or more for p < 0.05) declare a winner, and don't keep peeking and stopping early.
The key formula
- the measured click rates in each group
- the click rate of both groups pooled together
- how many users were in each group
- the 'standard error': the typical gap from luck alone, which shrinks as groups grow
How fast is it?
The arithmetic is trivial; the cost is users and time. To detect a gap half as big you need about 4 times as many users, because the noise shrinks like 1/√n. The biggest dangers aren't maths but habits: peeking every day and stopping as soon as it looks good inflates false wins.
Try it yourself
- Flip a coin 20 times, twice. How different are the two head counts, even though nothing changed?
- Why might an A/B test show 'B wins' in week one and 'no difference' by week four? (Novelty effect, or luck.)
Fun fact
Google famously tested 41 shades of blue for its links to see which got the most clicks, a story told by Marissa Mayer and criticised by designer Doug Bowman as decision-by-data gone too far.