Achievable logoAchievable logo
AP Statistics
Sign in
Sign up
Purchase
Textbook
Practice exams
Support
How it works
Resources
Exam catalog
Mountain with a flag at the peak
Textbook
Introduction
1. One variable data
2. Two variable data
3. Data collection
4. Probability and random variables
5. Sampling distributions
6. Categorical data
7. Quantitative data
7.1 Significance test for the difference of two means
7.2 The t distribution
7.3 Confidence intervals for the mean
7.4 Significance test for the mean
7.5 Confidence intervals for the difference of two means
7.6 Hypothesis testing errors
7.7 Paired data
8. Chi-square
9. Linear regression
Wrapping up
Achievable logoAchievable logo
7.5 Confidence intervals for the difference of two means
Achievable AP Statistics
7. Quantitative data
Our AP Statistics course is currently in development and is a work-in-progress.

Confidence intervals for the difference of two means

4 min read
Font
Discuss
Share
Feedback

Confidence intervals for the difference of two means

A confidence interval for the difference of two means estimates how different two population means are, based on sample data. This is useful when comparing two groups — such as teachers versus police officers, a treatment group versus a control group, or one school versus another — and you want to quantify the gap between their averages.

Sampling distribution of xˉ1​−xˉ2​

Recall the following facts about the sampling distribution of xˉ1​−xˉ2​:

  1. The set of all differences of sample means is approximately normally distributed.

  2. The mean of the set of differences of sample means equals μ1​−μ2​, which is the same as the difference of the population means.

  3. The standard deviation of the set of differences of sample means is:

σxˉ1​−xˉ2​​​≈n1​σ12​​+n2​σ22​​​​

Conditions for inference

Before finding a confidence interval or conducting a t-test, make sure these conditions are met:

  1. The samples are random (ideally simple random samples).
  2. The samples are taken independently of one another.
  3. If sampling without replacement, each sample is less than 10% of its respective population.

Confidence interval form

Definitions
Standard error of xˉ1​−xˉ2​
An estimate of the standard deviation of the sampling distribution of xˉ1​−xˉ2​.

SE​=n1​s12​​+n2​s22​​​​

Margin of error (ME)
The amount we add and subtract from the point estimate to form the confidence interval.

ME​=t∗⋅SE​

A confidence interval for the difference of two means is the point estimate ± the margin of error:

(xˉ1​−xˉ2​)±t∗n1​s12​​+n2​s22​​​​

Practice problem

Example:

A sociologist surveys high school teachers and police officers about their planned retirement age.

  • 28 randomly selected high school teachers have a sample mean planned retirement age of 64.5 and a sample standard deviation of 4.1 years.
  • 30 randomly selected police officers have a sample mean planned retirement age of 58.2 and a sample standard deviation of 5.3 years.

Part a.

Construct a 95% confidence interval for the difference in population means μ1​−μ2​, where μ1​ is the population mean planned retirement age of teachers and μ2​ is the population mean planned retirement age of police officers.

From the problem:

n1​xˉ1​s1​n2​xˉ2​s2​​=28=64.5=4.1=30=58.2=5.3​

Compute the point estimate:

xˉ1​−xˉ2​​=64.5−58.2=6.3 years​

Compute the standard error:

SE​=n1​s12​​+n2​s22​​​=284.12​+305.32​​=2816.81​+3028.09​​=0.6004+0.9363​≈1.2396​

Find the critical value for a 95% confidence interval:

t∗=t0.975,54​​≈2.005​

Compute the margin of error:

ME​=t∗⋅SE=2.005⋅1.2396≈2.485​

Construct the interval:

(xˉ1​−xˉ2​)±ME​=6.3±2.485​

Solution:

(spoiler)

Lower bound:

6.3−2.485​=3.815​

Upper bound:

6.3+2.485​=8.785​

The 95% confidence interval is (3.815,8.785).

Interpretation: We are 95% confident that teachers plan to retire, on average, between 3.82 and 8.79 years later than police officers.

Part b.

Based on your interval, is there convincing evidence that the average teacher’s planned retirement age is more than 5 years greater than the average police officer’s planned retirement age?

To answer this, check whether the entire confidence interval (3.815,8.785) lies above 5.

Solution:

(spoiler)

No. Because the 95% confidence interval includes values below 5, the data do not provide convincing evidence that μ1​−μ2​>5.

A difference greater than 5 years is plausible, but it isn’t strongly supported at the 95% confidence level. You’d have stronger evidence for the claim μ1​−μ2​>5 if the entire confidence interval were above 5.

Sampling distribution of xˉ1​−xˉ2​

  • Approximately normal, centered at μ1​−μ2​
  • Standard deviation estimated by n1​σ12​​+n2​σ22​​​

Conditions for inference

  • Samples must be random and independent of each other
  • If sampling without replacement, each sample must be <10% of its population

Confidence interval formula

  • Point estimate: xˉ1​−xˉ2​
  • Standard error: SE=n1​s12​​+n2​s22​​​
  • Full interval: (xˉ1​−xˉ2​)±t∗n1​s12​​+n2​s22​​​

Interpreting the interval

  • Interval estimates the true gap between two population means
  • To claim μ1​−μ2​>c, the entire interval must lie above c
    • If interval straddles c, no convincing evidence for that claim

Sign up for free to take 7 quiz questions on this topic

Previous
Next  | 7.6 Hypothesis testing errors
All rights reserved ©2016 - 2026 Achievable, Inc.

Confidence intervals for the difference of two means

Confidence intervals for the difference of two means

A confidence interval for the difference of two means estimates how different two population means are, based on sample data. This is useful when comparing two groups — such as teachers versus police officers, a treatment group versus a control group, or one school versus another — and you want to quantify the gap between their averages.

Sampling distribution of xˉ1​−xˉ2​

Recall the following facts about the sampling distribution of xˉ1​−xˉ2​:

  1. The set of all differences of sample means is approximately normally distributed.

  2. The mean of the set of differences of sample means equals μ1​−μ2​, which is the same as the difference of the population means.

  3. The standard deviation of the set of differences of sample means is:

σxˉ1​−xˉ2​​​≈n1​σ12​​+n2​σ22​​​​

Conditions for inference

Before finding a confidence interval or conducting a t-test, make sure these conditions are met:

  1. The samples are random (ideally simple random samples).
  2. The samples are taken independently of one another.
  3. If sampling without replacement, each sample is less than 10% of its respective population.

Confidence interval form

Definitions
Standard error of xˉ1​−xˉ2​
An estimate of the standard deviation of the sampling distribution of xˉ1​−xˉ2​.

SE​=n1​s12​​+n2​s22​​​​

Margin of error (ME)
The amount we add and subtract from the point estimate to form the confidence interval.

ME​=t∗⋅SE​

A confidence interval for the difference of two means is the point estimate ± the margin of error:

(xˉ1​−xˉ2​)±t∗n1​s12​​+n2​s22​​​​

Practice problem

Example:

A sociologist surveys high school teachers and police officers about their planned retirement age.

  • 28 randomly selected high school teachers have a sample mean planned retirement age of 64.5 and a sample standard deviation of 4.1 years.
  • 30 randomly selected police officers have a sample mean planned retirement age of 58.2 and a sample standard deviation of 5.3 years.

Part a.

Construct a 95% confidence interval for the difference in population means μ1​−μ2​, where μ1​ is the population mean planned retirement age of teachers and μ2​ is the population mean planned retirement age of police officers.

From the problem:

n1​xˉ1​s1​n2​xˉ2​s2​​=28=64.5=4.1=30=58.2=5.3​

Compute the point estimate:

xˉ1​−xˉ2​​=64.5−58.2=6.3 years​

Compute the standard error:

SE​=n1​s12​​+n2​s22​​​=284.12​+305.32​​=2816.81​+3028.09​​=0.6004+0.9363​≈1.2396​

Find the critical value for a 95% confidence interval:

t∗=t0.975,54​​≈2.005​

Compute the margin of error:

ME​=t∗⋅SE=2.005⋅1.2396≈2.485​

Construct the interval:

(xˉ1​−xˉ2​)±ME​=6.3±2.485​

Solution:

(spoiler)

Lower bound:

6.3−2.485​=3.815​

Upper bound:

6.3+2.485​=8.785​

The 95% confidence interval is (3.815,8.785).

Interpretation: We are 95% confident that teachers plan to retire, on average, between 3.82 and 8.79 years later than police officers.

Part b.

Based on your interval, is there convincing evidence that the average teacher’s planned retirement age is more than 5 years greater than the average police officer’s planned retirement age?

To answer this, check whether the entire confidence interval (3.815,8.785) lies above 5.

Solution:

(spoiler)

No. Because the 95% confidence interval includes values below 5, the data do not provide convincing evidence that μ1​−μ2​>5.

A difference greater than 5 years is plausible, but it isn’t strongly supported at the 95% confidence level. You’d have stronger evidence for the claim μ1​−μ2​>5 if the entire confidence interval were above 5.

Key points

Sampling distribution of xˉ1​−xˉ2​

  • Approximately normal, centered at μ1​−μ2​
  • Standard deviation estimated by n1​σ12​​+n2​σ22​​​

Conditions for inference

  • Samples must be random and independent of each other
  • If sampling without replacement, each sample must be <10% of its population

Confidence interval formula

  • Point estimate: xˉ1​−xˉ2​
  • Standard error: SE=n1​s12​​+n2​s22​​​
  • Full interval: (xˉ1​−xˉ2​)±t∗n1​s12​​+n2​s22​​​

Interpreting the interval

  • Interval estimates the true gap between two population means
  • To claim μ1​−μ2​>c, the entire interval must lie above c
    • If interval straddles c, no convincing evidence for that claim

More from Quantitative data

  • Significance test for the difference of two means
  • The t distribution
  • Confidence intervals for the mean
  • Significance test for the mean
  • Hypothesis testing errors