KatInterview

A/B Test Planning: Power, CUPED, Peeking, SRM and Causal Checks

Statistics & ExperimentsModel answer
HardModel answerStatistics & Experimentsab-testingpower-analysiscuped

Last updated

Plan an online experiment end to end: sample size, runtime, variance reduction, sequential monitoring, cluster randomization, an SRM diagnosis, and a causal design for observational data.

You are the data scientist responsible for a conversion experiment. Answer each part with formulas, numeric results and explicit assumptions.

A. Sample size. The baseline conversion rate is p0 = 0.045. You want to detect a 7% relative lift, so p1 = 0.045 × 1.07. Use a two-sided test with alpha = 0.05 and power = 0.90. Compute the per-variant sample size for a two-proportion z-test. State the z-values and explain how you treat the variance (pooled vs. unpooled). Then say how the answer changes if traffic is split 60/40.

B. Runtime. There are 1.2M daily visitors, 80% are eligible, and traffic is split 60/40 between A and B. How many calendar days are needed to reach the sample size from A? Discuss adjustments for repeat visitors and for other experiments competing for the same traffic.

C. Variance reduction. A pre-experiment covariate has R² = 0.20 with the outcome. Quantify the gain from CUPED, as a sample-size reduction and as an MDE reduction. When can CUPED introduce bias or stop helping?

D. Sequential monitoring. Stakeholders want to look at the results every day for 21 days. Propose an alpha-spending or group-sequential design, name the spending function, and give the approximate final critical z. Compare it with always-valid methods such as mSPRT or e-values.

E. Interference. User-level randomization is contaminated by spillovers between users. Propose a cluster-randomized design. Compute the design effect for ICC = 0.02 with average cluster sizes m = 5 and m = 50, and explain how the required sample size changes.

F. Sample ratio mismatch. The plan was a 60/40 split of 200,000 eligible users. On day 3 you see 110,000 users in A and 90,000 in B. Run a chi-square goodness-of-fit test, report the p-value, and describe what you do if the SRM is real.

G. Observational causal inference. A team analysed observational data with a strong pre-period trend. Sketch a DAG, pick an identification strategy (DID, IV or RDD), list its required assumptions, and propose concrete robustness checks.

Hints

Hint 1

For A, use pooled variance 2·p̄·q̄ under H0 and p0q0 + p1q1 under H1, with z = 1.96 and 1.2816. For an unequal split, hold Var(diff) fixed, so 1/nA + 1/nB must equal 2/n.

Hint 2

For B, the raw arithmetic gives a fraction of a day, so think about what actually limits enrollment: unique users rather than visits, the traffic slice your experiment owns, and weekly seasonality.

Hint 3

For F, the expected counts are 120,000 and 80,000, and the test has one degree of freedom. The statistic is huge, so the p-value is effectively zero. Focus on what you do next, not on the exact digits.