A/B Testing Statistics Cheat Sheet

Complete A/B testing methodology: sample size calculation, statistical power, minimum detectable effect, sequential testing, and the peeking problem.

Last Updated: May 1, 2025

Sample Size Calculation

ItemDescription
n = (z_alpha + z_beta)^2 * p(1-p) / delta^2Sample size per variant — binary metric (conversion rate)
z_alpha (Type I)z for significance level: 1.96 for 95% confidence (two-sided)
z_beta (Type II)z for desired power: 0.84 for 80% power, 1.28 for 90% power
Baseline Rate (p)Current conversion rate — higher variance near 50%
Minimum Detectable Effect (delta)Smallest improvement worth detecting — set by business requirements
For continuous metricsn = 2*(z_alpha + z_beta)^2 * sigma^2 / delta^2

Statistical Power

ItemDescription
Power = P(reject H0 | H1 is true)Probability of detecting a real effect — 1 - Type II error
Typical Power Target: 80%Industry standard — 20% chance of missing a real effect
90% PowerMore conservative — requires ~30% larger sample size
Power AnalysisRun BEFORE test: determine required sample size for desired power
Factors Affecting PowerEffect size, sample size, significance level, variance
Underpowered StudiesWaste resources — likely to miss real effects; ethical concerns

Sequential Testing & Peeking

ItemDescription
The Peeking ProblemRepeatedly checking p-values and stopping when significant inflates Type I error
Sequential Testing MethodsGroup sequential designs, alpha spending functions (O'Brien-Fleming)
Always Valid p-valuesDesigned for continuous monitoring — martingale-based stopping bounds
Fixed Horizon RulePre-specify sample size and only evaluate at the end — simplest, safest
Suggested ApproachUse a sequential testing framework from the start OR commit to fixed horizon

Practical Guidelines

ItemDescription
Randomization UnitUser, session, device — ensure independence and avoid contamination
Run DurationAt least one full business cycle (typically 1-2 weeks) to capture day-of-week effects
Guardrail MetricsMonitor key secondary metrics to detect negative side effects
Multiple VariantsBonferroni correction: alpha/m where m = number of comparisons
Separate Analysis from SetupThe person running the test shouldn't decide when it ends
Pro Tip: Never peek at results and stop early — the peeking problem inflates Type I error dramatically. Use sequential testing or fixed horizon. A test with 10 peeks at alpha=0.05 has ~20% false positive rate.