KatInterview

A/B Test Inference: Z-Test, Confidence Interval, and Power

Statistics & ExperimentsModel answer
MediumModel answerStatistics & Experimentsa-b-testinghypothesis-testingsample-size

Last updated

Evaluate statistical significance, construct a confidence interval, calculate required sample size, and apply a multiple-comparison correction for an online experiment.

An e-commerce platform ran a one-week experiment comparing a control experience (A) against a redesigned variant (B). Group A recorded 520 purchases across 10,000 visits. Group B recorded 630 purchases across 11,500 visits. Treat each visit as an independent Bernoulli trial. You may use a calculator.

a) Test the null hypothesis that the true conversion rates are equal (pB − pA = 0) against the two-sided alternative. Compute the pooled-proportion z statistic and the corresponding two-sided p-value.

b) Construct a 95% confidence interval for the true difference pB − pA using the unpooled (Wald) standard error.

c) For planning a future study, set the baseline rate p0 equal to the observed control rate. What equal per-arm sample size n (visits per group) is needed to detect an absolute improvement of 0.7 percentage points (i.e., p1 = p0 and p2 = p0 + 0.007) with two-sided α = 0.05 and 80% power, using the normal approximation? Use z₀.₉₇₅ = 1.96 and z₀.₈₀ = 0.84. Show the formula and report n rounded up to the next whole number.

d) Suppose you are monitoring 12 independent metrics simultaneously. What per-metric significance threshold would you apply under a Bonferroni correction to keep the family-wise error rate at 0.05?

Hints

Hint 1

For the z-test, pool both groups to estimate the shared rate under H0—the standard error under the null uses this pooled estimate, not the individual group rates.

Hint 2

The confidence interval uses each group's own observed rate separately—no pooling, because the CI does not assume the null is true.

Hint 3

Sample size scales as 1/δ², so halving the detectable effect requires roughly four times the data per arm.