Comparing Groups:
A/B Testing
Learn how to use confidence intervals to compare two groups and make data-driven decisions in real business scenarios.
What Is A/B Testing?
A/B testing is a controlled experiment where you split users into two groups: Group A (the control) sees the current version, and Group B (the treatment) sees a new version. You then compare a key metric between the two groups to decide which performs better.
Why Confidence Intervals?
A single sample mean is just an estimate. Different random samples will produce different results. A confidence interval gives us a range of plausible values for the true population parameter, accounting for sampling variability.
The Key Question in A/B Testing
When comparing Group A and Group B, the central question is: Is the difference between the two groups real, or could it be due to random chance?
The CI Formula for a Difference
To compare two group means, we build a confidence interval for the difference \( \bar{x}_A - \bar{x}_B \):
Standard Error of the Difference
The standard error (SE) measures how much the difference between sample means varies from sample to sample. It is the key ingredient in determining the width of the confidence interval.
Interpreting the Result
Once you compute the confidence interval for \( \bar{x}_A - \bar{x}_B \), the key question is: does the interval contain zero?
CI vs. p-value
Both confidence intervals and p-values answer the question "Is the difference real?" but they provide different types of information.
| Confidence Interval | p-value | |
|---|---|---|
| Tells you | Range of plausible effect sizes | Probability result is due to chance |
| Direction | Yes: which group is larger | Not directly |
| Magnitude | Yes: how big the effect could be | No: only if it's "significant" |
| Decision rule | Check if 0 is inside the interval | Check if \( p < 0.05 \) |
How to Apply It: Step by Step
Example 1: Email Campaign
A company tests two email subject lines. Group A (\( n = 500 \)): mean click rate \( \bar{x}_A = 12.4\% \), \( s_A = 3.2\% \). Group B (\( n = 500 \)): mean click rate \( \bar{x}_B = 14.1\% \), \( s_B = 3.5\% \).
Example 2: Pricing Test
An online store tests two prices. Price A (\$29.99, \( n = 200 \)): mean revenue per visitor = \$4.80, \( s_A = \$6.10 \). Price B (\$24.99, \( n = 200 \)): mean revenue = \$5.20, \( s_B = \$5.90 \).
Visualizing Both Examples
Why Sample Size Matters
Larger samples shrink the standard error, which narrows the confidence interval. This means you can detect smaller real differences between groups.
Practical vs. Statistical Significance
A result can be statistically significant but practically meaningless. With a large enough sample, even a tiny difference becomes "significant." Always ask: Is the effect large enough to matter?
Common Mistakes
Summary Reference Table
| Concept | Key Idea | Watch For |
|---|---|---|
| A/B Test | Compare two groups with one change | Random assignment matters |
| CI for Difference | \( (\bar{x}_A - \bar{x}_B) \pm z^* \cdot SE \) | Does interval contain 0? |
| Standard Error | \( \sqrt{s_A^2/n_A + s_B^2/n_B} \) | Shrinks with larger \( n \) |
| 95% CI | Use \( z^* = 1.96 \) | Wider CI = less precision |
| Significance | CI excludes 0 = statistically significant | Check practical significance too |
Question 1 of 5
A 95% confidence interval for \( \bar{x}_A - \bar{x}_B \) is (\(-3.2,\ -0.8\)). What can you conclude?
Question 2 of 5
Which of the following would narrow a confidence interval for the difference in means?
Question 3 of 5
Group A: \( n = 400,\ \bar{x}_A = 52,\ s_A = 10 \). Group B: \( n = 400,\ \bar{x}_B = 50,\ s_B = 10 \). What is the standard error of the difference?
Question 4 of 5
A 95% CI for the difference in conversion rates is (\(-0.5\%,\ 2.3\%\)). A manager says "Group B is definitely better." Is this correct?
Question 5 of 5
An A/B test with \( n = 1{,}000{,}000 \) per group finds a statistically significant difference of 0.01% in click-through rate. What should you consider next?