01 / 23
A
B

A/B Testing
Pitfalls

Learn to identify and avoid the most common mistakes in A/B testing: peeking at results, multiple comparisons, and selection bias.

Business Analytics

What Is A/B Testing?

An A/B test (also called a randomized controlled experiment) splits users randomly into two groups: a control group that sees the current version and a treatment group that sees a new variant. We then measure a key metric (conversion rate, revenue, click-through rate) and use statistical inference to decide whether the difference is real.

The Hypothesis Testing Framework

\( H_0 \) Null Hypothesis
There is no difference between A and B. Any observed gap is due to chance.
\( H_1 \) Alternative Hypothesis
There is a real difference between A and B that is not explained by random variation.

Why Pitfalls Matter

When we violate the assumptions behind hypothesis testing, we inflate the false positive rate: we conclude there is a real effect when there isn't one. Companies then ship changes that don't actually help, or worse, hurt the user experience.

Number of Tests Run
False Positive Rate
5%
~64%
1
10
20
5%
50%
100%
Actual false positive rate
Intended 5% level

Pitfall 1: Peeking at Results

Peeking (also called repeated significance testing) means checking your p-value before the pre-planned sample size is reached and stopping the test early if it looks significant. This dramatically inflates the false positive rate because you are giving yourself multiple chances to find significance by chance.

Days into experiment
p-value
\( \alpha = 0.05 \)
STOP?
STOP?
STOP?
1
4
7
14
0.20
0.10
0.05
0.01

Why Peeking Inflates Error Rates

1
1 peek: false positive rate = \( 5\% \) (as designed)
2
5 peeks: false positive rate rises to roughly \( 14\% \)
3
Continuous monitoring: false positive rate can exceed \( 30\% \)

Pitfall 2: Multiple Comparisons

When you test multiple metrics, multiple variants, or multiple user segments in the same experiment, each test is an independent chance to find a false positive. This is the multiple comparisons problem (also called the family-wise error rate inflation).

1 Experiment
5 Metrics
3 Variants
4 Segments
\( 5 \times 3 \times 4 = \)
60 tests!
At least 1 false positive is nearly guaranteed
\( 1-(1-0.05)^{60} \approx 0.95 \)

Correcting for Multiple Comparisons

Bonferroni
Divide \( \alpha \) by the number of tests: \( \alpha_{\text{adj}} = \frac{\alpha}{m} \). Simple but conservative.
Holm-Bonferroni
A step-down method: more powerful than Bonferroni. Sorts p-values and applies progressively weaker thresholds.
FDR (BH)
Controls the False Discovery Rate instead of family-wise error. Best when many tests are expected to be significant.

Pitfall 3: Selection Bias

Selection bias occurs when the groups in your A/B test differ systematically in ways other than the treatment. This violates the fundamental assumption of random assignment and can produce misleading results.

Self-Selection
Users opt into the experiment, so participants may differ from non-participants.
Survivorship Bias
Analyzing only users who completed the flow ignores those who dropped off, skewing results.
Time-of-Day Bias
Assigning groups based on when users arrive can confound with user behavior patterns.

Random vs. Biased Assignment

Random Assignment
Group A
Group B
Mixed ages
Mixed devices
Mixed ages
Mixed devices
✓ Balanced
Biased Assignment
Group A
Group B
Young users
Mobile only
Older users
Desktop only
✕ Confounded

Type I vs. Type II Errors

Type I (False Positive) Type II (False Negative)
Definition Rejecting \( H_0 \) when it is actually true Failing to reject \( H_0 \) when it is actually false
Probability \( \alpha \) (significance level) \( \beta \)
Consequence Ship a change that doesn't work Miss a change that would have helped
Pitfall link Peeking, multiple comparisons Underpowered tests (too small \( n \))
Controlled by Setting \( \alpha \) (e.g., 0.05) Increasing sample size or effect size

The Statistical Significance Rule

1
Pre-register your hypothesis, metric, and sample size before starting.
2
Adjust \( \alpha \) for every additional comparison using Bonferroni or BH correction.
3
Don't peek. Wait for the full sample, or use a sequential testing framework.
4
Verify randomization with balance checks before drawing conclusions.

How to Run a Valid A/B Test

1
Define one primary metric before starting. Secondary metrics are exploratory only.
2
Calculate required sample size using a power analysis (this formula is for continuous data; a similar one exists for proportions): $$ n = \frac{(z_{\alpha/2} + z_{\beta})^2 \cdot 2\sigma^2}{\delta^2} $$ where \( \delta \) is the minimum detectable effect.
3
Randomly assign users at the user level (not session or page view). Run an A/A test first.
4
Wait until the full sample is collected. Do not peek, or use sequential testing with adjusted thresholds.
5
Apply corrections if testing multiple variants or segments. Report the adjusted p-value.
6
Report effect size and confidence interval, not just "significant" or "not significant."

Example 1: Simple A/B Test

A company tests a new checkout button color. They plan for \( n = 10{,}000 \) users per group, \( \alpha = 0.05 \), and one primary metric (conversion rate). After collecting the full sample:

Control (A)
Conversion: 3.2%
(\( \frac{320}{10{,}000} \))
Treatment (B)
Conversion: 3.8%
(\( \frac{380}{10{,}000} \))

Example 2: The Peeking Trap

Same experiment, but the analyst checks the dashboard every day for 14 days. On day 4, the p-value briefly dips to \( 0.03 \), so they stop the test and declare victory.

D1
D3
D4
\( p=0.03 \)
STOPPED!
D6
D10
D14
\( p=0.12 \)
Not significant
Full sample

Example 3: Multiple Metrics Trap

A team tests a new homepage design and measures 8 metrics: page views, time on site, bounce rate, sign-ups, purchases, click-through rate, scroll depth, and shares. Only sign-ups shows \( p = 0.04 \). They celebrate and announce the redesign "significantly boosts sign-ups."

✓
Correct approach: Pre-register one primary metric (e.g., sign-ups). Test others as exploratory with adjusted thresholds.

Common Mistakes to Avoid

✕ Stopping Early
Ending the test as soon as the p-value dips below 0.05, without reaching your pre-planned sample size.
✕ Cherry-Picking Metrics
Running the test on many metrics and reporting only the one that was significant, without correction.
✕ Non-Random Groups
Splitting users by geography, device, or time instead of true random assignment, introducing confounders.
✕ Ignoring Power
Running the test with too few users to detect realistic effect sizes, then concluding "no effect" from a null result.

Summary: Pitfalls at a Glance

Pitfall What Goes Wrong How to Fix
Peeking Multiple looks inflate false positive rate beyond \( \alpha \) Wait for full \( n \) or use sequential testing
Multiple Comparisons Testing many metrics/variants multiplies chance of false discovery Bonferroni, Holm, or FDR correction
Selection Bias Non-random groups confound treatment with other variables Random assignment + A/A validation
Low Power Too few users to detect real effects (high Type II error) Power analysis before test; increase \( n \)

Question 1 of 5

An analyst checks the p-value of an A/B test every day for 10 days and stops the test on day 3 when \( p = 0.04 \). What pitfall is this an example of?

Question 2 of 5

A team tests 20 different metrics in one A/B test. Using the Bonferroni correction with \( \alpha = 0.05 \), what p-value threshold should each metric use?

Question 3 of 5

A company assigns all mobile users to variant A and all desktop users to variant B, then compares conversion rates. What is the primary concern?

Question 4 of 5

If you run 10 independent A/B tests, each at \( \alpha = 0.05 \), what is the approximate probability that at least one produces a false positive?

Question 5 of 5

Which of the following is the best practice to avoid inflating the false positive rate when you need to monitor an A/B test before the planned end date?