KatInterview

Calculate the required sample size for a checkout A/B test

Statistics & ExperimentsModel answer
EasyModel answerStatistics & Experimentsstatisticsa/b testingsample size

Last updated

Derive the minimum per-group sample size for a two-sample proportion test given baseline conversion, MDE, and standard error and power requirements.

Scenario

You are a data scientist at an e-commerce company. The product team wants to test a redesigned checkout button (treatment) against the current button (control). They ask you to tell them how many users each group needs before they can read out results.

Given information

ParameterValue
Baseline conversion rate (control)10%
Minimum Detectable Effect (MDE)+2 percentage points (i.e., 12% treatment)
Significance level α0.05 (two-tailed)
Desired statistical power 1 − β0.80

What is expected

  1. Write down the formula for the per-group sample size for a two-proportion z-test.
  2. Identify the critical z-values needed and explain where they come from.
  3. Plug in the numbers and compute the required sample size per group (you may leave your arithmetic transparent — show each intermediate value).
  4. State the total number of users needed across both groups.
  5. Explain intuitively what would happen to the sample size if the MDE were halved to +1 percentage point.

Hints

Hint 1

The two z-values you need correspond to α/2 (two-tailed critical value) and β (power). For α=0.05 two-tailed and 80% power, recall z_{0.025} ≈ 1.96 and z_{0.20} ≈ 0.84.

Hint 2

The pooled variance term uses both p_c and p_t. Under the null you pool the two rates; under the alternative you sum the individual variances. A common approximation pools at the average of the two proportions.

Hint 3

After computing n, always round up to the nearest whole number. Also mention the real-world factors that could inflate this number further (e.g., novelty effect, traffic seasonality).