🧪 A/B Testing

Comparing two versions to determine which performs better on a key metric.

Core Concept

Split users into two groups: control (A, the current version) and treatment (B, the new version). Measure a metric (conversion rate, click-through rate, engagement). Statistical test determines if observed difference is real or just random noise.

Setup

Null Hypothesis & P-values

Null hypothesis (H₀): "Versions A and B perform identically"

P-value: Probability of seeing the observed difference (or larger) if H₀ were true. If p < α (e.g., p < 0.05), reject H₀. Difference is statistically significant.

Important: p-value ≠ probability the result is real. It's a measure of how surprised we'd be under H₀.

Statistical Tests

T-test (continuous metrics)

Compares means of two groups. Assumes approximately normal distributions. Use for metrics like session duration, revenue per user.

Chi-squared test (binary metrics)

Compares counts in categories (e.g., converted vs. not converted). Standard for A/B tests on conversion rates.

Bayesian approach

Instead of p-values, compute posterior probability that B is better than A. More intuitive; allows stopping early. Requires specifying a prior.

Common Pitfalls

Sample Size Calculation

Larger effect sizes need fewer users. If you want 80% power (detecting a real effect 80% of the time) and α=0.05:

n ≈ (z_α/2 + z_β)² × (p₁(1−p₁) + p₂(1−p₂)) / (p₁ − p₂)²

Where p₁, p₂ are baseline and target conversion rates. Larger n if effect size is small.

When to Run A/B Tests

When NOT to Run A/B Tests