Mohamed A. Adel.

Experimentation & A/B Testing

Topic 4 of 11 · In Data Driven Decisions · September 9, 2026

⏱ 2 WeeksIntermediate

Design rigorous A/B tests, understand statistical significance and p-values, avoid common experimentation pitfalls, and learn when to use multi-armed bandits instead.

++++FREE LEARNING PATHDATA DRIVEN DECISIONDATA DRIVEN DECISIONS · PHASE 2 · INTERMEDIATEEXPERIMENTATION &A/B TESTINGDesign rigorous A/B tests, understand statistical s…· 2 / 3INTERMEDIATE2 WEEKSmotif / barsTOP 14635 · 35 · MODULE 4.9

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:

  1. Define the hypothesis — "Changing X will improve Y by Z% because [reasoning]."
  2. Choose the primary metric — one number that defines success (e.g., conversion rate, click-through rate, revenue per user).
  3. Select guardrail metrics — things that must not get worse (e.g., page load time, error rate, bounce rate).
  4. 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%).
  5. Determine test duration — run for at least one full business cycle (usually 1–2 weeks) to account for day-of-week effects.
  6. Randomize correctly — assign users to control/treatment randomly at the user level (not session level, to avoid contamination).
  7. Run the test — do not peek at results and stop early unless you have a pre-specified stopping rule.
  8. 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:

InputTypical valueWhat it means
Baseline rateYour current metricThe conversion rate (or other metric) you are trying to improve
MDE5–20% relativeThe 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.

ScenarioP-valueCIVerdict
Strong positive result0.01[1.2%, 3.1%]Significant and practically meaningful
Statistically significant but tiny effect0.04[0.01%, 0.05%]Significant but probably not worth implementing
Not significant0.35[-0.5%, 1.2%]Cannot conclude the change had any effect
Large effect but small sample0.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:

PitfallWhat happensHow to avoid it
PeekingStopping a test early when results look good — inflates false positive ratePre-commit to sample size; use sequential testing if you must peek
Novelty effectNew version gets more clicks just because it is new — fades after a few daysRun test for at least 1–2 full weeks; monitor effect size over time
Multiple testingTesting many variants or subgroups inflates false positive rateUse Bonferroni correction or false discovery rate control
Sample ratio mismatchThe actual split is not 50/50 — indicates a technical bugVerify the split before analyzing; if mismatch exists, investigate and potentially restart
ContaminationUsers see both control and treatment (e.g., session-level randomization)Randomize at the user level; use persistent user IDs
Ignoring segmentsAggregate results hide that the change helps some users and hurts othersAnalyze 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:

  1. Pre-registration: Every experiment is documented before it runs: hypothesis, metrics, sample size, and decision criteria. This prevents p-hacking and post-hoc rationalization.
  2. Decision log: Record what was decided, why, and what the data showed. Build institutional memory.
  3. Experiment reviews: Regularly review failed experiments — they often teach more than successful ones.
  4. Statistical literacy: Train product managers and designers to interpret results, not just hand off to data teams.
  5. 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.

  1. 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.
  2. Given a set of experiment results (p-value, confidence interval, sample size), determine whether to ship, kill, or iterate.
  3. 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.
  4. Compare A/B testing and multi-armed bandits for a news website testing headline formats. Which approach is better and why?
  5. 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:

  1. Write the hypothesis in a structured format
  2. Choose your primary metric and two guardrail metrics
  3. Calculate the required sample size (use MDE = 10% relative improvement, α = 0.05, power = 0.80)
  4. How long should the test run given your site gets 10,000 unique visitors per day?
  5. Write the pre-registration document

Deeper Worked Examples

These examples push further than the core content — each one is a complete, step-by-step solution you can follow and then reproduce on your own.

Sizing and planning a social-proof A/B test on product pages

Problem. A product manager wants to test adding '500 people bought this today' badges to product pages. Current conversion is 3.2% and the site receives 10,000 unique visitors a day. Design the experiment — sample, duration and go/no-go rule — before any code is written.
1

Step 1

Write the hypothesis in structured form: 'Adding a social-proof badge increases product-page purchase conversion by at least the 10% relative effect we care about (from 3.2% toward 3.5%).'
2

Step 2

Set the primary metric (product-page purchase conversion) and at least two guardrail metrics (page load time and refund rate) so a conversion gain that harms experience is caught.
3

Step 3

Run the power calculation: with baseline 3.2%, relative MDE of 10%, alpha of 0.05 and power of 0.80, one variant needs roughly 50,000 visitors.
4

Step 4

Convert that into duration: a 50/50 split gives about 5,000 visitors per variant per day, so about 20 days of data; run 4 weeks to cover a full day-of-week cycle and to let any novelty effect fade.
5

Step 5

Pre-register the stopping rule — no peeking, analyse once at the planned sample size — to protect the false-positive rate.
6

Step 6

Define the decision rule: ship only if the confidence interval for the lift excludes zero and its lower bound exceeds a practical threshold, after checking segments and guardrails.

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.

1

Task 1

Write a structured hypothesis with rationale, primary metric, and guardrail metrics.
2

Task 2

Calculate the required sample size (MDE = 15% relative improvement from 12% to 13.8%, α = 0.05, power = 0.80).
3

Task 3

Determine the test duration given 15,000 sign-ups per month.
4

Task 4

Identify at least three potential pitfalls specific to this experiment (hint: think about novelty effects, user expectations, and long-term behavior).
5

Task 5

Write the pre-registration document including decision criteria.
6

Task 6

Simulate results: if the 7-day trial converts at 14.2% (p = 0.03, CI = [12.8%, 15.6%]), would you ship? What if it converts at 13.1% (p = 0.12)?
DeliverableWhat it proves
Hypothesis documentYou can structure a testable business hypothesis
Sample size calculationYou can determine the right test duration
Pitfall analysisYou can anticipate problems specific to the test design
Pre-registrationYou can prevent p-hacking with upfront commitments
Results interpretationYou 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

The vocabulary this topic uses, defined the way a working professional would.
TermMeaning
Null hypothesisThe starting assumption that the change has no effect; the experiment tests how unlikely the observed data would be if it were true.
p-valueThe 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 powerThe 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 effectThe smallest real improvement you design the test to catch; smaller effects demand larger samples.
Novelty effectUsers 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 banditAn 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

These curated sources go deeper than this module: official docs, books, interactive practice, and full courses. Mix them into your routine to go from comfortable to professional.

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.

Open resource ↗

Evan Miller's Sample Size Calculator

The industry-standard free tool for calculating required sample size for A/B tests.

Open resource ↗

Introduction to Statistical Learning (free textbook)

A clear, accessible introduction to statistical methods including hypothesis testing, with R and Python labs.

Open resource ↗

A/B Testing (Udacity — Google)

A free course by Google covering the fundamentals of experimentation for product development.

Open resource ↗

Online experimentation at Microsoft (blog)

Microsoft's research team blog covering real-world experimentation challenges and solutions.

Open resource ↗

Chapter Quiz

Put this lesson to work: answer the questions below, get instant feedback and a pass/fail score. Score 70% or higher before you move on — that is your gate to the next topic.

Chapter Quiz — Experimentation & A/B Testing

Five questions on hypothesis testing, sample sizing, peeking, confidence intervals, and multi-armed bandits.

0 / 5

Question 1 of 5

The null hypothesis in an A/B test states that:

Knowledge Check

The null hypothesis (H₀) states that the change being tested has no effect on the metric. For example: 'Changing the button color does not affect click-through rate.' The experiment tests whether the observed data is unlikely enough under H₀ to reject it.
Every time you check results, there is a chance of seeing a 'significant' result by random noise. If you peek repeatedly and stop when you see significance, you dramatically inflate the false positive rate — far above the nominal 5%. The solution is to pre-commit to sample size, or use formal sequential testing methods that control the error rate across looks.
Statistical significance means the result is unlikely to be due to random chance (p < threshold). Practical significance means the effect is large enough to matter for the business. A statistically significant 0.01% improvement on a huge sample is statistically meaningful but practically worthless — the cost of implementing the change would exceed the benefit.
Use MAB when: the cost of showing the losing variant is high (lost revenue), you need results quickly, you are testing many variants, or the environment is non-stationary. Use traditional A/B when you need a definitive, statistically rigorous answer for a high-stakes decision or need explanatory insight into why something works.
The novelty effect is the phenomenon where a new version gets more engagement simply because it is new, not because it is better. The effect fades after a few days as users adapt. Control for it by running the test for at least 1–2 full business cycles (usually 1–2 weeks) and monitoring whether the effect size remains stable or decays over time.
P-hacking is manipulating the analysis (trying many variants, checking many subgroups, stopping at convenient times) until a 'significant' result appears. It is dangerous because with enough tests, random noise will produce significant-looking results by chance. It is the primary cause of the replication crisis in science. Prevention: pre-register your analysis plan and correct for multiple testing.

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.

Next Step

Congratulations — you just finished Experimentation & A/B Testing. The next topic is Statistical Thinking for Decisions. Press on when you are ready: it will build directly on what you practiced here.