Why the sample is calculated in advance

Sample size is not a technical detail, it is the foundation of a correct test. Launch a test and stop
it whenever the result looks appealing, and the probability of a false-positive conclusion rises
sharply. Across 20 interim checks it exceeds 60%, even when there is no real effect at all.

Calculating the sample before launch sets an objective horizon: the test runs exactly as long as it
needs to — no shorter, no longer.

The formula and its key parameters

For a two-proportion test, the sample size per variation is:

n = 2 × (z_α/2 + z_β)² × p̄(1 − p̄) / δ²

z_α/2 = 1.96  (α = 0.05, two-sided test)
z_β   = 0.84  (80% power)
p̄    = (p_A + p_B) / 2
δ     = |p_B − p_A|  (MDE)
Baseline CR MDE (relative) n per variation Days at 5K/day
2% 10% ~37,600 ~15
2% 5% ~150,000 ~60
5% 10% ~14,200 ~6
5% 5% ~56,900 ~23

Important: the smaller the MDE and the lower the baseline conversion rate, the longer the test.
Asking to detect a +1% lift on a 2% CR means a test running into hundreds of thousands of users.

The three inputs that determine sample size

1. Baseline conversion rate. The lower it is, the more observations a reliable measurement needs.
A 0.5% CR requires four times the sample of a 2% CR.

2. Minimum detectable effect (MDE). What is the smallest lift that has practical value for the
business? An MDE of 5% needs four times the data of an MDE of 10%. The business sets the MDE from its
own economics, not from statistics.

3. Error levels α and β. The standard is α = 0.05 (a 5% risk of a false positive) and power
1 − β = 80%. For critical decisions, such as changing the homepage, raising power to 90% is sensible.

Common mistakes

  • Calculating the sample after the fact. Once the test has produced a significant result, a
    retrospective calculation adds nothing. The calculation is a statement of intent made before launch.
  • Ignoring the number of variations. In an A/B/C test you have to correct for multiple
    comparisons, or the combined type I error rate grows from 5% to roughly 14%.
  • Confusing absolute and relative MDE. A lift of 0.2 pp on a 2% CR is a 10% relative lift, not
    0.2%. The difference in the resulting sample is fourfold.
  • Forgetting two-sided testing. If the test asks better or worse, z_α/2 = 1.96; if it asks only
    better, z_α = 1.645. Using a one-sided test without an explicit justification is methodologically risky.