A/B test sample size
ab_test_planPlan A/B tests by calculating visitors per variant and days needed to detect a meaningful lift from baseline metrics, power, significance, and daily traffic.
Instructions
Plan an A/B test: visitors needed per variant to detect the smallest lift that matters (mde) at a given power, and/or the smallest lift detectable with a given n_per_variant; days needed from daily_traffic. Conversion: baseline_rate. Continuous: baseline_sd (and baseline_mean for a relative mde). Use in an exploration (planning a future test); a running hypothesis test sizes itself in step 4.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mde | No | Smallest lift that matters: absolute (0.005 = +0.5 percentage points) or relative with mde_type "relative" (0.1 = +10%). | |
| alpha | No | Significance level. Default 0.05. | |
| power | No | ||
| metric | Yes | ||
| mde_type | No | absolute | |
| variants | No | ||
| alternative | No | two-sided (default), greater (first > second / sample > value), or less. | two-sided |
| baseline_sd | No | ||
| baseline_mean | No | ||
| baseline_rate | No | ||
| daily_traffic | No | ||
| n_per_variant | No | ||
| adjust_for_variants | No | Split α across the comparisons with the control (Bonferroni) when there are 3+ variants. |