Pitfalls: Peeking, Novelty Effects, and Multiple Comparisons
Explore key pitfalls in A/B testing such as peeking, novelty effects, and multiple comparisons that can inflate false-positive rates and mislead conclusions. Learn how to predefine analysis windows, fix stopping rules, and properly control multiple testing to ensure reliable, valid experimental results. This lesson helps you design, analyze, and interpret A/B tests to avoid common validity errors and make sound business decisions based on trustworthy data.
A dashboard reports p < 0.05 for a checkout treatment on day 3, so the result looks ready to ship. By day 14, the conversion lift has disappeared. The hypothesis test may have been calculated correctly, yet the conclusion was still wrong because the decision process changed the evidence being used.
A correctly sized experiment needs more than enough users. Repeatedly checking results, treating an early behavioral spike as a lasting effect, or searching across many outcomes can create a convincing but false win. These are validity problems in the experiment plan and readout process, not arithmetic mistakes in a p-value calculation.
Peeking changes the chance of a false win
When the true conversion rate is 0.05 in both variants, a single test at the planned end of a 14-day experiment has a small chance of producing p < 0.05 by random variation. Peeking means checking that same experiment repeatedly and ending it as soon as a favorable result appears.
The wrong intuition is that each daily check uses the same 0.05 threshold, so the overall experiment still has the same false-positive risk. Each check creates another opportunity for ordinary noise to cross the threshold. Stopping at the first crossing keeps the favorable accident and discards later evidence that might reverse it.
The simulation compares two policies across many experiments with no real treatment effect. One policy tests only after day 14. The other tests every day and labels the experiment a win at the first result below 0.05.
Lines 9–19: The code computes a standard two-proportion z-test p-value using the pooled conversion rate under the null; returning
1.0when the standard error is zero avoids division-by-zero when both groups have identical all-0 or all-1 outcomes.Lines 43–55: The code implements the “peeking” policy by re-testing the cumulative data each day and locking in a win the first time
p < 0.05, which is what inflates the overall false-positive rate.Lines 57–63: The code separates the two decision rules: Strategy A only counts significance at Day 14, while Strategy B counts any earlier crossing (even if the final Day-14 p-value is not significant). ...