📋 KEY INSIGHTS
- Experiment design β deciding how to collect data before collecting it β is the single highest-leverage intervention in the data science workflow. A well-designed experiment answers causal questions that no amount of observational analysis can address. A poorly designed one produces data that cannot answer the question regardless of the sophistication of the analysis applied to it.
- Statistical power is the probability that an experiment detects a true effect of a given size. The most common mistake in experiment design is running underpowered experiments: declaring “no significant effect” when the experiment was too small to detect the effect even if it exists. Power analysis β computing the required sample size before running the experiment β prevents this.
- Multi-armed bandit algorithms are an alternative to fixed A/B tests that adaptively allocate traffic to better-performing variants during the experiment, reducing the cost of exposing users to inferior treatments. They are particularly valuable for short-lived campaigns and personalisation contexts where the cost of exposure matters.
- Sequential testing (always-valid p-values, e-values, and group sequential designs) allows experimenters to monitor results continuously and stop early when significance is reached, without inflating the false positive rate. This solves the “peeking problem” that invalidates naive early stopping of standard A/B tests.
- Factorial designs test multiple factors simultaneously in the same experiment, allowing efficient estimation of both main effects and interactions. A 2Γ2 factorial design testing two binary factors requires only 4 conditions to estimate all main effects and their interaction β far more efficient than running two separate A/B tests.
- The external validity of an experiment β whether its results generalise beyond the specific population, time period, and context of the test β is as important as internal validity. A statistically significant result from a two-week test on a specific user segment may not reflect long-term or population-wide effects, and this limitation should be stated explicitly in every experiment report.
Every A/B test, clinical trial, and product experiment is an instance of experiment design β the branch of statistics concerned with how to collect data efficiently to answer causal questions. Yet the majority of data scientists running experiments have never formally studied experiment design, and the gaps show: underpowered tests that declare “no effect” when effects are real, multiple testing that inflates false discovery rates, novelty effects that produce spurious short-term wins, network interference that violates the independence assumption, and sequential peeking that invalidates p-values. These are not subtle issues β they represent systematic errors that cause organisations to make bad product and business decisions at scale. This guide covers the core concepts of experiment design that every data scientist needs: power analysis, A/B test mechanics and common pitfalls, multi-armed bandits, sequential testing, factorial designs, and the analysis of observational data when randomisation is not feasible.
Statistical Power and Sample Size Calculation
A hypothesis test has four parameters that are related by a fixed constraint: the significance level Ξ± (probability of a false positive β rejecting Hβ when it is true), the power 1βΞ² (probability of a true positive β correctly rejecting Hβ when the alternative is true), the effect size Ξ΄ (the minimum difference worth detecting), and the sample size N. Given any three, the fourth is determined. In practice, Ξ± is set by convention (0.05 for most business experiments), power is set at 0.80 or 0.90 (meaning 20% or 10% false negative rate), and the effect size is the minimum business-relevant difference β leading to a specific required sample size. Running the experiment without this calculation first, then analysing results with whatever sample accumulated, is the most common experiment design error.
For a two-sample proportion test (the most common case in product A/B testing β comparing conversion rates), the required sample size per group is approximately N = 2(z_{Ξ±/2} + z_Ξ²)Β²p(1βp)/δ², where p is the baseline conversion rate, Ξ΄ is the minimum detectable effect (MDE), z_{Ξ±/2} is the z-score for the significance level, and z_Ξ² is the z-score for the power level. For Ξ± = 0.05 (two-tailed) and power = 0.80: z_{Ξ±/2} = 1.96 and z_Ξ² = 0.84. The key insight from this formula is that required sample size scales as 1/δ²: halving the MDE quadruples the required sample. This is why long-running experiments are needed to detect small effects β and why declaring “no effect” from a short experiment that was never powered to detect the relevant effect size is a serious methodological error. Our hypothesis testing guide covers the z-test and t-test mechanics, and our statistics fundamentals guide covers the CLT approximations that justify the normal distribution assumption in these formulas.
| Baseline Rate | MDE (Relative +5%) | MDE (Absolute) | Required N/group (80% power) | Required N/group (90% power) |
|---|---|---|---|---|
| 2% | 2.1% | 0.10% | ~148,000 | ~198,000 |
| 5% | 5.25% | 0.25% | ~59,000 | ~79,000 |
| 10% | 10.5% | 0.50% | ~29,000 | ~39,000 |
| 20% | 21% | 1.00% | ~13,700 | ~18,400 |
| 50% | 52.5% | 2.50% | ~4,800 | ~6,500 |
A/B Testing β Pitfalls and Best Practices
Standard A/B testing β randomly assigning subjects to control (A) and treatment (B), measuring the outcome of interest, and applying a statistical test to determine whether the observed difference is consistent with chance β is conceptually simple but operationally complex. The A/B testing guide covers the full mechanics; here we focus on the design pitfalls most commonly encountered in industry practice.
Novelty and primacy effects are systematic biases that affect almost every product experiment. Novelty effect: users interact more with any new feature simply because it is new, producing an inflated short-term treatment effect that decays to a lower long-term steady-state. Primacy effect (the opposite): users who are habituated to the existing experience show lower engagement with a changed feature initially, producing a deflated short-term effect that improves as users adapt. Both effects cause short-duration experiments to produce estimates that do not reflect the long-run causal effect of the change. The standard mitigation is to run experiments long enough to reach steady-state, and to plot the treatment effect over time β if the effect is growing or shrinking, the experiment has not yet stabilised.
Network interference (also called SUTVA violation β Stable Unit Treatment Value Assumption) occurs when a user’s outcome is affected by other users’ treatment assignments. This happens in social networks (treating one user changes their interactions with untreated friends), marketplace platforms (treating sellers affects buyer outcomes), and communication products. Standard A/B test analysis assumes independence between units; network interference violates this and biases treatment effect estimates in either direction. The solutions are cluster-based randomisation (randomising at the network cluster level rather than the user level), ego-network splitting, or using switchback designs for marketplace experiments. Our causal inference guide covers the SUTVA assumption and its violations in detail.
Multiple testing inflation is the systematic increase in false discovery rate that results from testing many hypotheses simultaneously β testing 20 metrics in a single experiment at Ξ± = 0.05 gives an expected one false positive even if no treatment effect exists. The Bonferroni correction (Ξ±/m for m tests) and the Benjamini-Hochberg procedure (controlling the false discovery rate rather than the family-wise error rate) are the standard corrections, covered alongside their power implications in our hypothesis testing guide.
Sequential Testing and the Peeking Problem
The most widespread statistical malpractice in industry A/B testing is “peeking”: checking the p-value of an ongoing experiment repeatedly and stopping when p < 0.05 is first observed, regardless of whether the pre-specified sample size has been reached. Peeking inflates the false positive rate dramatically: a nominally 5% test that is checked daily for 30 days has a true false positive rate of approximately 30%. Yet peeking is almost universal in organisations where business pressure to “know if it’s working” is high.
Sequential testing methods provide valid inference under continuous monitoring. Always-valid confidence sequences (Johari et al., 2022, used by Optimizely’s Stats Engine) construct confidence intervals that are valid at any stopping time, without requiring a pre-specified sample size. E-values (GrΓΌnwald et al.) are a fully sequential alternative to p-values with better composition properties. Group sequential designs (O’Brien-Fleming, Pocock boundaries) pre-specify a finite set of interim looks with adjusted significance thresholds that preserve the overall Ξ±. All three approaches allow valid early stopping for efficacy (stopping when a positive result is clear) or futility (stopping when the treatment effect is clearly zero or below the MDE). The connection to Bayesian hypothesis testing β where the posterior probability of Hβ is updated continuously as data arrives, with no p-value inflation β is worth noting: Bayesian A/B testing naturally supports sequential analysis.
Factorial Designs and Multi-Armed Bandits
When multiple product changes are being evaluated simultaneously, running separate A/B tests for each is inefficient and misses interactions between changes. Factorial designs assign subjects to all combinations of factor levels in a balanced design, enabling simultaneous estimation of main effects and interactions. A 2Β² design (two binary factors, four treatment cells: AβBβ, AβBβ, AβBβ, AβBβ) estimates both main effects and their interaction with a single experiment at the same total sample size as two separate A/B tests β but with the additional benefit of the interaction estimate. If the interaction is large (the effect of A depends on whether B is present), separate tests would give misleading results about each factor in isolation.
Multi-armed bandit (MAB) algorithms adaptively allocate traffic to arms (variants) based on observed performance, trading off exploration (learning about underperforming arms) and exploitation (directing traffic to better arms). The Ξ΅-greedy policy allocates fraction Ξ΅ of traffic to random exploration and 1βΞ΅ to the current best arm. Thompson Sampling β drawing a sample from the posterior distribution of each arm’s reward rate and selecting the arm with the highest sample β is the Bayesian approach and typically outperforms Ξ΅-greedy. The reinforcement learning guide covers the multi-armed bandit problem as the simplest setting in RL, building up to contextual bandits (where the optimal arm depends on user features β essentially a personalisation policy) and full sequential decision problems. MABs are particularly valuable for short-lived campaigns (e-commerce promotions, news article selection) where the cost of exposing users to suboptimal variants during a fixed-horizon A/B test is high. The connection to recommendation systems is direct: the explore-exploit problem in recommenders is a contextual bandit problem.
The choice between A/B testing and MAB depends on the objective. A/B testing provides a clean causal estimate of the treatment effect and controls false positive rate precisely β it is the right choice when the goal is to make a confident, durable product decision. MAB minimises regret during the experiment β it is the right choice when the goal is to maximise short-term performance while learning. The model evaluation framework applies to experiment evaluation too: the metric you optimise during the bandit exploration (click-through rate, conversion rate) must be chosen carefully to avoid optimising a proxy that does not reflect the true business objective.
✦ SUMMARIZE THIS ARTICLE WITH AI
The statistical mechanics of A/B testing β z-tests, t-tests, chi-squared tests, confidence intervals β are in our A/B Testing guide and Hypothesis Testing guide. Power analysis and sample size calculations for different test types are in our Statistics Fundamentals guide. Causal inference beyond randomised experiments β difference-in-differences, regression discontinuity, and instrumental variables β is in our Causal Inference guide. The multi-armed bandit and reinforcement learning connection is in our Reinforcement Learning guide. Bayesian A/B testing with Thompson Sampling is covered in our Bayesian Statistics guide.



