A/B Testing — Complete Guide for Data Analysts (With Python)
Everything you need to know about A/B testing for data analyst interviews — hypothesis design, statistical significance, sample size calculation, and common pitfalls.
You don’t need to be a statistician — but you must understand these six concepts to answer any A/B testing question in an interview.
Hypothesis
Every test starts with a falsifiable hypothesis. Format: “We believe [change] will increase [metric] for [users] because [reason].”
- Null hypothesis (H₀): no effect
- Alternative (H₁): there is an effect
- One-tailed vs two-tailed tests
Primary & Guardrail Metrics
Define what you’re optimising (primary) and what must not break (guardrail) before running the experiment.
- Primary: conversion rate, revenue
- Guardrail: session length, NPS
- Pre-commit — no changing after
Sample Size
Calculate before you run. Too small = underpowered test. Too long = wasted time. Use a power calculator.
- Baseline conversion rate
- Minimum detectable effect (MDE)
- 80% power, 95% significance
Statistical Significance
p-value < 0.05 means less than 5% chance of seeing this result if the null hypothesis were true. Not "95% the test won."
- p-value interpretation
- Confidence intervals
- Two-sample z-test vs t-test
Type I & Type II Errors
Type I: false positive — you ship a feature that doesn’t work. Type II: false negative — you kill a feature that did work.
- α = Type I error rate (usually 0.05)
- β = Type II error rate (usually 0.20)
- Power = 1 − β
Common Pitfalls
Peeking, novelty effect, network effects, leakage — the traps that invalidate real experiments.
- Peeking = inflated Type I error
- Novelty effect fades in 2–3 weeks
- Network leakage in social products
The most common A/B test implementation for conversion rate experiments — run this in a Python mock and explain every line.
These are the questions candidates get wrong most often — with the model answers.
Want to practise A/B testing questions?
Book a free analytics mock — we cover experiment design, statistical interpretation, and Python implementation with live feedback.
Book Free Analytics Mock