01 / 20
A B

Comparing Groups:
A/B Testing

Learn how to use confidence intervals to compare two groups and make data-driven decisions in real business scenarios.

Business Statistics

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.

Group A: Control
Sees the original design, price, or feature. This is your baseline.
Group B: Treatment
Sees the new variation. You measure if this produces a meaningful change.

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?

Group A Group B Overlap Metric Value

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 \):

\( \bar{x}_A, \bar{x}_B \)
Sample means of Group A and Group B
\( s_A, s_B \)
Sample standard deviations
\( n_A, n_B \)
Sample sizes per group
\( z^* \)
Critical value (1.96 for 95% CI)

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.

1
Larger samples produce a smaller SE, which narrows the interval and gives more precision.
2
More variability (larger \( s \)) produces a larger SE, widening the interval.
3
We add the variances because the groups are independent: uncertainty from each group compounds.

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?

0 Contains 0 Excludes 0 Not significant Significant!
Contains 0
The difference could be zero: no strong evidence that the groups differ.
Excludes 0
The difference is statistically significant: the groups likely differ.

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

1
Collect data from both groups: record sample sizes \( n_A, n_B \), means \( \bar{x}_A, \bar{x}_B \), and standard deviations \( s_A, s_B \).
2
Compute the difference in means: \( \bar{x}_A - \bar{x}_B \).
3
Calculate the SE: \( SE = \sqrt{s_A^2 / n_A + s_B^2 / n_B} \).
4
Build the interval: \( (\bar{x}_A - \bar{x}_B) \pm z^* \cdot SE \). Use \( z^* = 1.96 \) for 95%.
5
Interpret: If 0 is outside the interval, the difference is statistically significant at the chosen level.

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

CI for Difference in Means 0 -3 -2 -1 1 2 Email Test (-2.12, -1.28) Pricing Test (-1.58, 0.78) Significant Not Significant

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.

True Difference n = 50 per group n = 200 per group n = 1000 per group

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?

Statistical Significance
The CI excludes zero: we're confident the difference is not zero.
Practical Significance
The difference is large enough to justify the cost of changing.

Common Mistakes

✕ Peeking Early
Checking results before collecting enough data inflates false positive rates. Decide your sample size before starting.
✕ Ignoring Overlap
Two non-overlapping group CIs suggest significance, but always compute the CI for the difference directly for a precise answer.
✕ Confusing CI Meaning
A 95% CI does NOT mean there's a 95% probability the true value is inside. It means 95% of such intervals would contain the true value.

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?