All About Sample-Size Calculations for A/B Testing: Novel Extensions and Practical Guide

Jing Zhou, Jiannan Lu, Anas Shallah14 Sep 2023

Problem

Online experiments randomize users, but the metric is often computed per session or per event. Rows of one user are correlated, so the standard i.i.d. sample size formula underestimates the variance and asks for too few observations. The test is then underpowered, and its type I error can rise. Plugging δrel·μx into the absolute-lift formula for a percentage lift adds a smaller error.

Example from the article: a user-randomized test on session conversion rate, where historical data shows 4.2 sessions per user. The i.i.d. formula asks for 1,440 sessions, while the correlated-data formula needs about 3,986 sessions.

Solution in brief

Size the test in randomization units (users) with a formula built on the same Delta method that is used to analyze the result. One constant, h, computed from user-level aggregates of historical data, replaces σ2 in the usual formula. The paper also gives a formula for relative lift, a rule for the smallest observed difference that reaches p < 0.05, and a way to shorten the test with an unequal split.

Questions this case answers
  • How to calculate the required number of randomization units when the analysis unit is more granular than the randomization unit and observations within a unit are correlated
  • How to size an experiment for a relative effect when the baseline mean is itself estimated with error
  • How to find the smallest observed effect that will reach statistical significance at the design stage
  • How to size an A/B test when users are randomized but the metric is computed per session or per event?

Tools and methods

  • Delta method sample size — number of users from user-level sums of sessions and converted sessions
  • Relative-lift formula — sizing for a percentage effect
  • Minimal observed difference (MOD) — smallest observed lift that reaches p < 0.05, known at design time
  • Unequal allocation — smaller treatment share to shorten the test
Continue reading — it's free

Google or a one-time email code. No password.