Planning Runtime and Stopping Rules for a Delivery Add-On Test
Statistics & ExperimentsModel answerLast updated
Size an A/B test on a 22% conversion metric with household clustering, plan weekly sequential looks, and estimate how variance reduction shortens the run.
You are planning an A/B test on the same-day delivery add-on rate, the share of checkouts where the customer selects same-day delivery.
Givens
- Baseline rate: 22%.
- Minimum detectable effect: a 5% relative lift.
- Two-sided α = 0.05, power = 80%.
- Traffic: assume 120k checkouts per day, of which 20% are eligible for the feature. Volume differs by weekday and spikes sharply on Sundays.
- Randomization is by household, and checkouts within a household have an intra-household correlation of 0.10.
Tasks
- Sample size and duration. Compute the required sample size per arm. Adjust it for household clustering (design effect). Convert it to calendar time, taking the weekly cycle into account. State any assumptions you need, such as the share of eligible traffic given to the test.
- Safe monitoring. Design a plan that lets stakeholders check results before the end without inflating the false-positive rate. Explain how it changes the expected duration if the feature truly works.
- Volatile Sundays. Suppose the metric is especially noisy on Sundays in one large metro market. Propose stratified randomization and/or CUPED. Estimate the variance reduction you would expect and how it affects the run length.
Hints
Hint 1
Use the two-proportion formula with the variance of each arm: n = (z_α/2 + z_β)² · [p1(1−p1) + p2(1−p2)] / δ². Then multiply by the design effect 1 + (m−1)ρ.
Hint 2
Convert to time using weekly totals, not daily averages, and always round up to whole weeks so every weekday appears equally in both arms. Consider that the test will probably get only a slice of eligible traffic.
Hint 3
For peeking, use weekly looks with an alpha-spending function (O'Brien-Fleming style). For variance reduction, remember that CUPED shrinks variance by (1 − r²), where r is the correlation between the pre-period covariate and the outcome. Required sample size scales with variance.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Framing
Three things matter here: the power math, the fact that calendar time is dictated by weekly cycles and clustering rather than by raw n alone, and the discipline of monitoring without inflating false positives. I would state my assumptions up front, because the prompt leaves some open.
a) Sample size and duration
Effect size. Baseline p₁ = 0.22. A 5% relative lift gives p₂ = 0.231, so the absolute difference is δ = 0.011.
Per-arm sample size (unpooled two-proportion test):
n = (1.96 + 0.8416)² · [p₁(1−p₁) + p₂(1−p₂)] / δ²
- (2.8016)² ≈ 7.85
- Variance terms: 0.1716 + 0.1776 ≈ 0.3492
- n ≈ 7.85 × 0.3492 / 0.000121 ≈ 22,650 per arm
Clustering. Households check out repeatedly, so observations are not independent. Design effect = 1 + (m − 1)ρ, where m is the average number of checkouts per household during the test and ρ = 0.10.
- m ≈ 2 gives DEFF = 1.10, so n ≈ 24,920 per arm (about 49,840 total).
- m = 3 gives DEFF = 1.20, so n ≈ 27,200 per arm.
m grows with test length, so estimate it from historical data for the planned window. Analyze with cluster-robust standard errors (or household-level aggregation with the delta method). Otherwise p-values are too optimistic.
Converting to time. I read the traffic as 24k eligible checkouts per day (20% of 120k), or about 168k per week. At full allocation, 50k would arrive in about two days. That is the wrong answer to give:
- Two days is not representative of weekly behavior, and the effect may differ on Sunday versus midweek.
- Novelty and primacy effects need time to wash out for a habitual choice like delivery speed.
- Rule: run whole weeks, with a minimum of one and preferably two.
A realistic assumption is that the test gets about 10% of eligible traffic because other experiments share it. That yields about 16,800 checkouts per week, so 49,840 / 16,800 ≈ 2.97. Run 3 full weeks (21 days). Compute from weekly totals rather than "average day × days", because the Sunday spike distorts partial weeks.
b) Peeking-safe monitoring
Checking a fixed-horizon test daily and stopping at the first p < 0.05 can push the real false-positive rate to 20% or more. Instead, pre-register a group sequential design with Lan-DeMets O'Brien-Fleming alpha spending.
- Looks: end of weeks 1, 2 and 3 (information fractions 1/3, 2/3, 1). Weekly looks keep each analysis balanced across weekdays.
- Boundaries: approximately |z| > 3.4, 2.4, 2.0. Early stopping needs overwhelming evidence, and the last look is close to the ordinary test.
- Cost: the maximum sample grows only about 1.7%, to roughly 50.7k total, which still fits in three weeks.
- Futility: an optional non-binding rule at week 2 (for example, conditional power under 10%). Non-binding means α stays valid even if the rule is overridden.
Expected duration if the effect is real. The standardized drift at full information is about 2.83, so the expected z at week k is 2.83·√(k/3).
| Look | Expected z | Chance of stopping at this look |
|---|---|---|
| Week 1 | 1.63 | about 4% |
| Week 2 | 2.31 | about 42% |
| Week 3 | n/a | about 54% (remainder) |
Expected duration ≈ 0.04·1 + 0.42·2 + 0.54·3 ≈ 2.5 weeks (17–18 days) versus 21 days fixed. Under the null you almost always run the full three weeks, unless futility stops you at week 2.
Alternatives and extras.
- Pocock boundaries stop earlier but inflate the maximum sample by 15–20% and make the final test stricter. OBF is the usual product choice.
- Sample-ratio-mismatch and guardrail checks can run daily because they are not efficacy tests. They can halt a test but never declare a win.
- Always-valid methods (mSPRT, confidence sequences) permit continuous monitoring. I would still make ship decisions only at week boundaries.
c) Taming Sunday volatility
Do not drop Sundays. That biases the result toward weekday behavior. Reduce variance instead.
CUPED. Use each household's attach rate over the prior 4–8 weeks as the covariate X. The adjusted outcome is Y − θ(X − E[X]) with θ = Cov(X, Y)/Var(X), and variance shrinks by (1 − r²).
- For a binary per-checkout outcome, household history typically gives r ≈ 0.4–0.5, which means 16–25% reduction for returning households.
- New households have no history, so they get no benefit. With about 85% returning, expect 15–20% overall.
Stratification. Stratify randomization by market and tenure, or post-stratify by market × weekday. This removes between-stratum variance such as Sunday swings in one metro. For a binary metric the gain is modest (about 3–8%), but it protects against chance imbalance in the noisiest stratum.
Combined: plan on roughly a 20% variance reduction.
- n per arm ≈ 24,920 × 0.8 ≈ 19,940 (about 39.9k total).
- Fixed horizon: 39.9k / 16.8k ≈ 2.37 weeks, which still rounds up to 3 weeks, because whole weeks are required.
- Sequential design: drift rises to about 2.83/√0.8 ≈ 3.16, so the week-2 stopping chance rises to about 50% and expected duration falls to roughly 2.4 weeks.
- To get a fixed two-week test (about 33.6k total), you would need about a 33% reduction, which is unrealistic with these tools alone.
Ways to spend the gain instead of shortening the test: detect a smaller lift (around 4.5% relative), lower the traffic allocation so other experiments can run, or keep the three-week window for stronger seasonal coverage and better power on segment cuts.
Common mistakes
- Ignoring clustering, or analyzing at the checkout level with naive standard errors.
- Stopping at the first significant daily look.
- Running a fractional number of weeks, so one weekday is overrepresented.
- Claiming a variance reduction without tying it to the correlation between covariate and outcome.
- Applying CUPED with a covariate measured after assignment, which can introduce bias.