01 / 20
A B

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.

Business Statistics

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.

Control (A)
The existing version: no changes applied. This is your baseline for comparison.
Treatment (B)
The modified version with one specific change you want to evaluate.

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.

Revenue
Test pricing, layouts, or features before rolling out to all users.
User Experience
Measure actual behavior rather than relying on survey opinions.
Risk Reduction
Catch harmful changes early before a full-scale launch.

The Experiment Flow

All Users Random Assignment Control (A) No change Treatment (B) New version Compare Results

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.

\(H_0\): Null Hypothesis
There is no difference between A and B: \( p_B - p_A = 0 \). Any observed difference is due to chance.
\(H_1\): Alternative Hypothesis
There is a real difference: \( p_B - p_A \neq 0 \). The treatment has a genuine effect.

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.

Test Statistic Distribution under \(H_0\) Reject Reject Fail to reject

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.

1
Larger sample size increases power: more data means less noise in your estimates.
2
Larger effect size is easier to detect: a 10% lift is easier to find than a 1% lift.
3
Higher \(\alpha\) increases power but also increases false positive risk: always a trade-off.

Key Metrics in A/B Testing

Primary Metric
The main outcome you want to improve: e.g., conversion rate, revenue per user, click-through rate.
Guardrail Metrics
Metrics that must not degrade: e.g., page load time, error rate, user retention. They protect against hidden harm.
Secondary Metrics
Additional outcomes that help explain why the treatment worked or failed: e.g., time on page, bounce rate.

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.

A/B Test Result Primary metric improved? Yes All guardrails within bounds? Yes Ship It No Investigate

How to Run an A/B Test

1
Define your hypothesis: state what you expect to change and by how much (e.g., "Changing the button color will increase CTR by 5%").
2
Choose metrics: select a primary metric, guardrail metrics, and any secondary metrics to track.
3
Calculate sample size: run a power analysis using \(\alpha = 0.05\), \(\text{Power} = 0.80\), and your minimum detectable effect (MDE).
4
Randomize and run: split users randomly 50/50 and let the experiment run until the required sample size is reached.
5
Analyze results: compute the \(p\)-value, check confidence intervals, and verify all guardrail metrics.
6
Decide: ship if statistically significant and guardrails pass. Otherwise investigate or iterate.

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\%\).

1
\(H_0\): \(p_B - p_A = 0\) (no difference in conversion rate).
2
\(H_1\): \(p_B - p_A > 0\) (new design improves conversion).
3
MDE: \(0.5\%\) absolute lift (\(3.7\% - 3.2\%\)).
4
Guardrails: page load time must stay under 2s, cart abandonment must not increase by more than 1%.

Example: Sample Size Calculation

For a two-proportion z-test, the sample size per group is approximately:

1
For \(\alpha = 0.05\) (one-sided): \(z_{\alpha} = 1.645\). For \(\beta = 0.20\): \(z_{\beta} = 0.842\).
2
Numerator: \((1.645 + 0.842)^2 = 6.183\). Variances: \(0.032 \times 0.968 + 0.037 \times 0.963 = 0.0666\).
3
Denominator: \((0.005)^2 = 0.000025\). So \(n = \frac{6.183 \times 0.0666}{0.000025} \approx 16{,}471\) per group.

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

✕ Peeking at Results
Checking results repeatedly before the required sample size inflates your false positive rate well above \(\alpha\).
✕ Stopping Early
Ending the test as soon as \(p < 0.05\) ignores the pre-calculated duration and biases results toward significance.
✕ Ignoring Guardrails
Shipping a treatment that harms page speed, error rates, or retention because you only watched the primary metric.

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?