Experimentation & A/B Testing
Topic 4 of 11 · In Data Driven Decisions · September 9, 2026
Design rigorous A/B tests, understand statistical significance and p-values, avoid common experimentation pitfalls, and learn when to use multi-armed bandits instead.
Overview
Experimentation is the engine of data-driven decision making. Without experiments, every decision is a guess — an educated guess perhaps, but a guess nonetheless. A/B testing (and its more sophisticated relatives) lets you causally determine what works, what does not, and why. It is the only method that definitively answers "did this change cause that outcome?"
This topic takes you from the theory of hypothesis testing through the mechanics of designing, running, and interpreting A/B tests. You will learn sample size calculation, statistical significance, p-values, confidence intervals, and the common pitfalls that ruin experiments (peeking, multiple testing, novelty effects). You will also learn when multi-armed bandits are a better choice than traditional A/B testing. By the end, you will be able to design and evaluate experiments that produce trustworthy, actionable results.
Before You Start
- Review the correlation-versus-causation rule from Data Literacy — randomisation is the sole reason an A/B test may claim causation.
- Be able to read a confidence interval and say immediately whether it includes zero and what that implies.
- Have Evan Miller's sample-size calculator open and reproduce its outputs for a 5% baseline and a 10% relative minimum detectable effect.
- Write down one past product change that shipped without a test; you will analyse its risks using the pitfalls table.
- Confirm you can name a primary metric and two guardrail metrics from your own product before the lesson.
Learning Objectives
- Understand the principles of hypothesis testing and controlled experiments
- Design an A/B test: hypothesis, variant, metrics, sample size, and duration
- Calculate or use tools to determine required sample size for a test
- Interpret p-values, confidence intervals, and statistical significance correctly
- Identify and avoid common A/B testing pitfalls (peeking, multiple testing, novelty effects)
- Understand when and why to use multi-armed bandits over traditional A/B tests
- Design an experimentation framework suitable for an organization
Prerequisites
Start with DDDM Fundamentals and KPI Design & Metric Frameworks for the basics of data-driven decisions and metrics. Some comfort with basic statistics (means, percentages) helps — you do not need a statistics course yet.
The Logic of Hypothesis Testing
Every experiment starts with two competing hypotheses:
- Null hypothesis (H₀): The change has no effect. "Redesigning the button color does not change click rate."
- Alternative hypothesis (H₁): The change has an effect. "Redesigning the button color changes click rate."
The experiment does not prove H₁ is true — it asks: if H₀ were true, how likely is the data we observed? If the probability is very low (typically below 5%), we reject H₀ and accept H₁. This is not certainty — it is probabilistic reasoning.
Key terms:
- Control group: the unchanged version (status quo)
- Treatment/variant group: the version with the change
- Primary metric: the one number that determines success or failure
- Guardrail metrics: metrics you monitor to ensure the change does not cause unintended harm
A/B Test Design: Step by Step
A well-designed A/B test follows these steps:
- Define the hypothesis — "Changing X will improve Y by Z% because [reasoning]."
- Choose the primary metric — one number that defines success (e.g., conversion rate, click-through rate, revenue per user).
- Select guardrail metrics — things that must not get worse (e.g., page load time, error rate, bounce rate).
- Calculate sample size — use a power calculator (e.g., Evan Miller's calculator) with your baseline rate, minimum detectable effect (MDE), statistical significance threshold (usually 95%), and power (usually 80%).
- Determine test duration — run for at least one full business cycle (usually 1–2 weeks) to account for day-of-week effects.
- Randomize correctly — assign users to control/treatment randomly at the user level (not session level, to avoid contamination).
- Run the test — do not peek at results and stop early unless you have a pre-specified stopping rule.
- Analyze results — check statistical significance, effect size, and segment-level results.
Sample Size and Statistical Power
Sample size is the most critical design decision. Too small and you waste time running a test that cannot detect real effects (underpowered). Too large and you waste resources detecting trivial effects (overpowered).
The four inputs to sample size calculation:
| Input | Typical value | What it means |
|---|---|---|
| Baseline rate | Your current metric | The conversion rate (or other metric) you are trying to improve |
| MDE | 5–20% relative | The smallest improvement you would consider meaningful |
| Significance (α) | 0.05 (95%) | The probability of a false positive you are willing to accept |
| Power (1-β) | 0.80 (80%) | The probability of detecting a real effect if it exists |
Rule of thumb: if your baseline conversion is 5% and you want to detect a 10% relative improvement (to 5.5%), you need roughly 30,000–40,000 users per variant. For most web experiments, plan for at least 1–2 weeks of traffic.
Interpreting Results: P-values, Confidence Intervals, Effect Size
P-value: The probability of observing your results (or more extreme) if the null hypothesis is true. A p-value of 0.03 means there is a 3% chance the result is due to random noise. Convention: p < 0.05 is "statistically significant."
Confidence interval (CI): A range of values within which the true effect likely falls. A 95% CI of [0.2%, 1.8%] means you are 95% confident the true improvement is between 0.2% and 1.8%. If the CI includes zero, the result is not significant.
Effect size: How big the actual change is. A statistically significant p-value of 0.01 on a 0.01% improvement is meaningless in practice. Always report: p-value + effect size + confidence interval.
| Scenario | P-value | CI | Verdict |
|---|---|---|---|
| Strong positive result | 0.01 | [1.2%, 3.1%] | Significant and practically meaningful |
| Statistically significant but tiny effect | 0.04 | [0.01%, 0.05%] | Significant but probably not worth implementing |
| Not significant | 0.35 | [-0.5%, 1.2%] | Cannot conclude the change had any effect |
| Large effect but small sample | 0.08 | [-0.3%, 5.0%] | Promising but underpowered — need more data |
Common A/B Testing Pitfalls
Even well-designed tests fail due to these frequent mistakes:
| Pitfall | What happens | How to avoid it |
|---|---|---|
| Peeking | Stopping a test early when results look good — inflates false positive rate | Pre-commit to sample size; use sequential testing if you must peek |
| Novelty effect | New version gets more clicks just because it is new — fades after a few days | Run test for at least 1–2 full weeks; monitor effect size over time |
| Multiple testing | Testing many variants or subgroups inflates false positive rate | Use Bonferroni correction or false discovery rate control |
| Sample ratio mismatch | The actual split is not 50/50 — indicates a technical bug | Verify the split before analyzing; if mismatch exists, investigate and potentially restart |
| Contamination | Users see both control and treatment (e.g., session-level randomization) | Randomize at the user level; use persistent user IDs |
| Ignoring segments | Aggregate results hide that the change helps some users and hurts others | Analyze by segment (device, new vs returning, geography) after confirming aggregate results |
Multi-Armed Bandits: When to Use Them
Traditional A/B testing splits traffic 50/50 for the entire test duration. Multi-armed bandits (MAB) dynamically shift traffic toward the better-performing variant as the test runs.
When to use MAB:
- The cost of showing the losing variant is high (lost revenue during the test)
- You need results quickly and cannot wait for full statistical power
- You are testing many variants simultaneously
- The environment is non-stationary (user preferences change over time)
When to stick with traditional A/B:
- You need a definitive, statistically rigorous answer for a high-stakes decision
- You need to understand why something works (MAB optimizes faster but gives less explanatory insight)
- You are making a one-time decision, not ongoing optimization
Algorithms: ε-greedy (explore randomly with probability ε), Thompson Sampling (Bayesian approach — probabilistically favors better variants), Upper Confidence Bound (UCB — balances exploration and exploitation).
Building an Experimentation Culture
Tools and statistics are not enough — a true experimentation culture requires organizational commitment:
- Pre-registration: Every experiment is documented before it runs: hypothesis, metrics, sample size, and decision criteria. This prevents p-hacking and post-hoc rationalization.
- Decision log: Record what was decided, why, and what the data showed. Build institutional memory.
- Experiment reviews: Regularly review failed experiments — they often teach more than successful ones.
- Statistical literacy: Train product managers and designers to interpret results, not just hand off to data teams.
- Velocity: Aim for one experiment per team per sprint. Speed of learning matters more than individual test outcomes.
Hands-On Practice
Practice designing and interpreting experiments with these exercises.
- Design an A/B test for a hypothetical feature: write the hypothesis, choose primary and guardrail metrics, and calculate the required sample size using an online calculator.
- Given a set of experiment results (p-value, confidence interval, sample size), determine whether to ship, kill, or iterate.
- Identify the flaw in each of these experiments: (a) a test that ran for 2 days, (b) a test with 50 variants and one "significant" result, (c) a test where the winning variant showed 3% improvement but the CI included 0.
- Compare A/B testing and multi-armed bandits for a news website testing headline formats. Which approach is better and why?
- Write a pre-registration document for an experiment you would run at your workplace or a hypothetical company.
Scenario: You are the data analyst for an e-commerce site. The product manager wants to test whether adding social proof ("500 people bought this today!") to product pages increases conversion rate. Current conversion rate is 3.2%.
Design the experiment:
- Write the hypothesis in a structured format
- Choose your primary metric and two guardrail metrics
- Calculate the required sample size (use MDE = 10% relative improvement, α = 0.05, power = 0.80)
- How long should the test run given your site gets 10,000 unique visitors per day?
- Write the pre-registration document
Deeper Worked Examples
Sizing and planning a social-proof A/B test on product pages
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Common Mistakes
- Peeking at results before the test is complete and stopping early — dramatically inflates false positive rate
- Running too many variants or subgroups without correcting for multiple testing
- Stopping a test after one day because results 'look good' — novelty effects are real
- Using session-level randomization instead of user-level — causes contamination
- Ignoring guardrail metrics — a conversion boost that tanks page load time is a net loss
- Conflating statistical significance with practical significance — tiny effects on huge samples are significant but meaningless
- Not pre-registering the hypothesis — invites p-hacking and post-hoc rationalization
Real-World Usage
Google runs over 10,000 experiments per year across Search, Ads, Maps, and every product. One famous experiment: Google tested 41 shades of blue for a link color. The winning shade generated an estimated $200 million in additional annual revenue. While the specific number is debated, the principle is sound — small, well-tested changes compound into massive impact at scale. Netflix tests everything from thumbnail images to autoplay behavior to subtitle fonts. Their experimentation platform runs hundreds of concurrent tests, and they pre-register every experiment to maintain rigor. The lesson: at scale, experimentation becomes the primary driver of product improvement, and the compound effect of many small wins is enormous.
Mini Project
Business problem: A SaaS company offering a free trial wants to test whether reducing the trial from 14 days to 7 days increases paid conversion. The hypothesis is that urgency will drive faster decisions and reduce "forgot about it" drop-offs.
Current metrics: Trial-to-paid conversion rate = 12%, average time to convert = 8 days, 15,000 new trial sign-ups per month.
Task 1
Task 2
Task 3
Task 4
Task 5
Task 6
| Deliverable | What it proves |
|---|---|
| Hypothesis document | You can structure a testable business hypothesis |
| Sample size calculation | You can determine the right test duration |
| Pitfall analysis | You can anticipate problems specific to the test design |
| Pre-registration | You can prevent p-hacking with upfront commitments |
| Results interpretation | You can make nuanced ship/kill decisions |
Key Takeaways
- Hypothesis testing asks: if the change had no effect, how likely is the observed data?
- A well-designed A/B test specifies: hypothesis, primary metric, guardrail metrics, sample size, and duration
- Sample size depends on baseline rate, MDE, significance level, and power
- Always report p-value + effect size + confidence interval — never just p-value
- Common pitfalls include peeking, novelty effects, multiple testing, and contamination
- Multi-armed bandits dynamically shift traffic and are best for ongoing optimization
- Pre-registration, decision logs, and experiment reviews build an experimentation culture
Key Terms & Glossary
| Term | Meaning |
|---|---|
| Null hypothesis | The starting assumption that the change has no effect; the experiment tests how unlikely the observed data would be if it were true. |
| p-value | The probability of seeing the observed result, or something more extreme, if the null hypothesis were true; a p below 0.05 is conventionally called statistically significant. |
| Statistical power | The probability that an experiment will detect a real effect if one exists, commonly set at 80%; low power means real effects are often missed. |
| Minimum detectable effect | The smallest real improvement you design the test to catch; smaller effects demand larger samples. |
| Novelty effect | Users engaging with a new version simply because it is new; the uplift fades after a few days, so tests need to run a full cycle to reveal it. |
| Multi-armed bandit | An experiment that dynamically shifts traffic toward the currently better-performing variant, chosen when showing the losing version is costly or the environment changes quickly. |
Learning Resources
Trustworthy Online Controlled Experiments (Ron Kohavi et al.)
The definitive textbook on A/B testing from Amazon/Microsoft/Microsoft researchers. Covers everything from design to pitfalls to organizational culture.
Evan Miller's Sample Size Calculator
The industry-standard free tool for calculating required sample size for A/B tests.
Introduction to Statistical Learning (free textbook)
A clear, accessible introduction to statistical methods including hypothesis testing, with R and Python labs.
A/B Testing (Udacity — Google)
A free course by Google covering the fundamentals of experimentation for product development.
Online experimentation at Microsoft (blog)
Microsoft's research team blog covering real-world experimentation challenges and solutions.
Chapter Quiz
Chapter Quiz — Experimentation & A/B Testing
Five questions on hypothesis testing, sample sizing, peeking, confidence intervals, and multi-armed bandits.
Question 1 of 5
The null hypothesis in an A/B test states that:
Knowledge Check
End-of-Topic Exam
Hint: Combine significance, effect size and interval width for each case.
Model answer: (a) Ship: significant, large effect and a narrow interval whose lower bound of 3% still justifies the change. (b) Kill or iterate: not significant, and the interval crossing zero means we cannot rule out no effect; likely underpowered, so iterate to a bigger sample or a sharper hypothesis. (c) Kill: statistically significant but practically trivial — 0.1% on a huge sample will not repay the implementation cost; treat this as the classic significance-versus-practical-significance trap.
Hint: Think about how many looks are being taken and what that does to the false-positive rate.
Model answer: This is peeking: every look at the data adds a chance of stopping on a random fluctuation that looks significant, so the effective false-positive rate climbs far above the nominal 5% — stopping early also risks a novelty effect. The fix is to pre-commit to the required sample size and analysis date before the test starts, analyse once at that point, and if peeking is unavoidable use a formal sequential-testing procedure designed for multiple looks.
Hint: Weigh the cost of showing a losing variant against the need for a rigorous answer.
Model answer: A multi-armed bandit is the better fit: the news site wants to minimise the revenue cost of showing losing headlines, needs an answer quickly, and is testing several variants at once. A bandit shifts traffic to the leading headline as evidence accumulates, which a fixed A/B split cannot do. You would fall back on a traditional A/B test only if you needed a definitive statistical verdict for a high-stakes decision or wanted to understand why a headline works — neither applies here.