The lift is the input you have the most say over. Watch what halving it does to n.
for lift in [0.04, 0.02, 0.01, 0.005]: print(lift, sample_size_per_arm(0.10, lift))
Predict
Each time the lift halves, the users needed grow by about what factor?
Pick one to see what it prints.
Each time the lift halves, the users grow about four times.
Users per arm, by the lift on a 10% baseline
4 points
1,033
2 points
3,839
1 point
14,749
0.5 points
57,760
The standard error shrinks like 1/n. Detecting half the lift still needs the MDE 2.8 standard errors from zero, so the standard error has to halve, and that takes four times the users. In the formula, it's the Δ2 in the denominator.
The practice test checks this at a 30% baseline: 2 points needs 8,391 per arm and 1 point needs 33,272, a ratio of 3.97. At 10%, 3,839 becomes 14,749, a ratio of 3.84. Neither is exactly 4, because the treatment rate moves with the lift and takes its variance along.
It works in your favor too. Kohavi and colleagues point out that a test planned to detect a 1% change catches a bug that drops the metric by 20% in 1/400 of the planned time, since (20/1)2=400. Big regressions show up fast. That's why a risky change can go to a sliver of traffic first.
In the editor, write scaled_n(n, lift_from, lift_to): the quick rescaling by the lift squared, to check against the exact numbers.
Pick an answer above to see the rest
Instructions
1
Write scaled_n(n, lift_from, lift_to): the users a test sized for lift_from would need for lift_to, if n grows with one over the lift squared.
2
Return a float. The bars in this step show the exact numbers, so you can see how close the shortcut lands.