A/B Testing
Concepts & Guardrails
Learn how businesses use controlled experiments to make data-driven decisions, using hypothesis testing and statistical significance to separate real effects from random noise.
What Is A/B Testing?
An A/B test (also called a split test) is a randomized controlled experiment that compares two versions of something: a Control (A) and a Treatment (B). Users are randomly assigned to one group, and we measure a key outcome to decide which version performs better.
Why A/B Testing Matters
Without experiments, decisions rely on intuition or correlation: both are unreliable. A/B testing provides causal evidence that a change actually improves outcomes rather than merely co-occurring with them.
The Experiment Flow
The Hypothesis Framework
Every A/B test is built on a formal hypothesis test. We define two competing claims about the population parameter (e.g., conversion rate) and use data to decide between them.
Statistical Significance and the \(p\)-value
After collecting data, we compute a \(p\)-value: the probability of seeing a result as extreme as (or more extreme than) what we observed, assuming \(H_0\) is true.
Type I vs. Type II Errors
Every hypothesis test can make two kinds of mistakes. Understanding them is critical for setting up guardrails in your A/B test.
| \(H_0\) Actually True | \(H_0\) Actually False | |
|---|---|---|
| Reject \(H_0\) | Type I Error (\(\alpha\)) False Positive |
✓ Correct Decision True Positive |
| Fail to Reject \(H_0\) | ✓ Correct Decision True Negative |
Type II Error (\(\beta\)) False Negative |
Statistical Power and Sample Size
Power is the probability of correctly detecting a real effect: \( \text{Power} = 1 - \beta \). Higher power means fewer false negatives. The standard target is \(80\%\) power.
Key Metrics in A/B Testing
What Are Guardrail Metrics?
Guardrails are constraints that bound your experiment. They ensure your treatment doesn't cause unintended damage to other parts of the system, even if the primary metric looks great.
How to Run an A/B Test
Example: Setting Up a Test
An e-commerce company wants to test a new checkout button design. Current conversion rate is \(p_A = 3.2\%\). They want to detect an improvement to at least \(p_B = 3.7\%\).
Example: Sample Size Calculation
For a two-proportion z-test, the sample size per group is approximately:
Example: Interpreting Results
After running the test with 17,000 users per group, the results come in:
| Control (A) | Treatment (B) | |
|---|---|---|
| Users | 17,000 | 17,000 |
| Conversions | 541 | 646 |
| Conversion Rate | 3.18% | 3.80% |
| \(p\)-value | 0.0012 | |
| Guardrail: Load Time | 1.4s | 1.3s ✓ |
| Guardrail: Cart Abandon | 68.1% | 67.5% ✓ |
Common Mistakes in A/B Testing
Summary: Key Concepts at a Glance
| Concept | Definition | Typical Value |
|---|---|---|
| \(\alpha\) (Significance Level) | Max acceptable false positive rate | 0.05 (5%) |
| \(\beta\) (Type II Error Rate) | Probability of missing a real effect | 0.20 (20%) |
| Power (\(1 - \beta\)) | Probability of detecting a real effect | 0.80 (80%) |
| \(p\)-value | Probability of data given \(H_0\) true | Reject if < \(\alpha\) |
| MDE | Minimum Detectable Effect | Depends on context |
| Guardrail Metric | Must not degrade significantly | Fail = do not ship |
Question 1 of 5
In an A/B test, what does the null hypothesis (\(H_0\)) typically state?
Question 2 of 5
A test yields \(p = 0.03\) with \(\alpha = 0.05\). What should you conclude?
Question 3 of 5
A company launches a treatment that increases revenue by 4%, but page load time increases from 1.5s to 3.2s (guardrail threshold: 2s). What should they do?
Question 4 of 5
A Type II error in an A/B test means:
Question 5 of 5
Which of the following will increase the statistical power of an A/B test?