A/B Testing and Experiment Design
Designing, sizing, running and analysing controlled experiments so product and marketing decisions rest on causal evidence.
Intermediate · about 6 hours · difficulty 3/5
Learn first: Hypothesis Testing and p-values
An A/B test randomly splits users between a control and one or more variants, then compares outcomes. Randomisation is what lets you claim causality.
Before launch
- Hypothesis and primary metric: one metric decides the test; others are guardrails (e.g. refunds, page load time).
- Unit of randomisation: user, session, account, or region. Randomise at the level where the effect happens.
- Minimum detectable effect and sample size: decide the smallest lift worth detecting, then compute required sample size for your power (often 80%). Online calculators make this quick.
- Duration: run whole weeks to cover weekday patterns; fix the end date in advance.
During the test
- Check sample ratio mismatch: if you expected 50/50 and got 52/48 with large numbers, something is broken.
- Avoid peeking: repeatedly checking and stopping at the first significant result inflates false positives. Use fixed horizons or sequential methods designed for peeking.
Analysis
- Compare the primary metric with a confidence interval for the difference.
- Look at guardrails and a few pre-planned segments; treat unplanned segment wins as hypotheses for a new test.
- Watch for novelty effects and network effects where users influence each other.
Pitfall: declaring "no difference" from an underpowered test. Absence of evidence is not evidence of absence. Move on when you can write a complete test plan including sample size and decision rule.
Key concepts
- Randomisation and control groups
- Primary and guardrail metrics
- Sample size and minimum detectable effect
- Sample ratio mismatch
- Peeking and sequential testing
- Segment analysis without p-hacking
- Novelty and network effects
- Bayesian A/B testing
Mini project
Analyse the public Kaggle 'Cookie Cats' mobile game A/B test dataset: check sample ratio, compare day-1 and day-7 retention between variants with confidence intervals, and write a launch recommendation.
Check yourself
Why does stopping a test as soon as p drops below 0.05 increase your false positive rate?
Free resources
- Evan Miller's A/B testing tools (Evan Miller)
- OpenIntro Statistics (OpenIntro)
- Kaggle Learn (Kaggle)