Dove's LibraryDove's Library

4.7 - Constructing a Confidence Interval for the Difference Between Two Population Means

Overview

A two-sample tt-interval estimates the difference between two population means, μ1−μ2\mu_1 - \mu_2, using independent random samples from two populations or the two groups in a randomized experiment. It answers questions like "How much more sleep do juniors get than seniors, on average?" This topic covers choosing the procedure, stating the parameter, checking the conditions, and calculating the interval. Topic 4.8 covers interpreting the interval and using it to judge claims.

Choosing the procedure

Based on sample data, you can build a confidence interval to estimate the difference between two population means. For two independent samples, the right procedure is a two-sample tt-interval for the difference between population means. Use it when:
  • the response variable is quantitative, so you're comparing means, not proportions;
  • there are two independent samples, or two treatment groups formed by random assignment; and
  • the question asks you to estimate the size of the difference ("how much," "estimate," "construct an interval").
Exam questions often test whether you can tell it apart from the procedures next to it:
Situation
Procedure
One group, quantitative variable
One-sample tt-interval for μ\mu (Topic 4.2)
Paired data: the same subjects measured twice, or matched pairs
One-sample tt-interval for μd\mu_d, on the differences (Topic 4.2)
Two independent groups, quantitative variable
Two-sample tt-interval for μ1−μ2\mu_1 - \mu_2
Two independent groups, categorical variable
Two-sample zz-interval for p1−p2p_1 - p_2 (Topic 3.10)
To decide between paired and two-sample, ask: does each value in one group have a natural partner in the other group (the same person, a twin, a matched plot of land)? If yes, the data are paired. If the groups are separate people or objects, use the two-sample procedure.

Stating the parameter

The parameter must name the difference in the population means, the response variable, and both populations, in context, with a clear order of subtraction. For example:
μJ−μS\mu_J - \mu_S, where μJ\mu_J is the true mean number of hours of sleep on a school night for all juniors at the school and μS\mu_S is the true mean for all seniors at the school.
Just writing "the difference in mean sleep" leaves out which groups, which means, and which order. For an experiment, the "populations" are the treatments, for example "the true mean number of words recalled by people like these volunteers if they all studied in silence."

Checking the conditions

A two-sample tt-interval for a difference between population means requires three conditions:
  1. Randomization condition: the data should be collected using two independent random samples or a randomized experiment.
  1. 10% condition: when sampling without replacement, each sample size must be at most 10% of its population size: n1≤10%N1n_1 \leq 10\%N_1 and n2≤10%N2n_2 \leq 10\%N_2. This condition isn't needed for a randomized experiment, since no population is being sampled.
  1. Sample data condition: both samples have n≥30n \geq 30, or the problem says both population distributions are approximately normal. If either sample is smaller than 30, check graphs of both samples for strong skewness and outliers.
Each condition has a job: randomization makes the groups representative (or comparable, in an experiment), the 10% condition keeps the values close enough to independent for the standard error formula, and the sample data condition makes the sampling distribution of xˉ1−xˉ2\bar{x}_1 - \bar{x}_2 close enough to normal for the tt procedure.
For small samples, a dotplot, boxplot, or stemplot of each sample is enough. Say what you see: "the dotplots of both groups show no strong skewness and no outliers." Just writing "normal" is too vague, and it's a common way to lose the point.

Calculating the interval

Like every confidence interval, this one is point estimate ± margin of error. The point estimate for μ1−μ2\mu_1 - \mu_2 is the difference in sample means, xˉ1−xˉ2\bar{x}_1 - \bar{x}_2. The standard error estimates how much that difference varies from sample to sample, using the sample standard deviations s1s_1 and s2s_2:
SExˉ1−xˉ2=s12n1+s22n2SE_{\bar{x}_1 - \bar{x}_2} = \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}
The margin of error is the critical value times the standard error, t∗s12n1+s22n2t^*\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}, so the interval is:
(xˉ1−xˉ2)±t∗s12n1+s22n2(\bar{x}_1 - \bar{x}_2) \pm t^* \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}
Here t∗t^* is the critical value that captures the central C% of a tt-distribution with the appropriate degrees of freedom. This matches the formula sheet's general form: statistic ± (critical value)(standard error of the statistic).

Degrees of freedom

For two samples there's no simple df formula. The exact df comes from a long formula that your calculator applies for you, and it's usually a decimal. It always falls between the smaller of n1−1n_1 - 1 and n2−1n_2 - 1 and n1+n2−2n_1 + n_2 - 2.
  • With technology (preferred): use the df the calculator reports. This gives the most accurate interval.
  • Without technology: use df equal to the smaller of n1−1n_1 - 1 and n2−1n_2 - 1, and look up t∗t^* in Table B. If that df isn't a row in the table, use the next smaller row. This is the conservative choice: a smaller df gives a larger t∗t^*, so the interval comes out a little wider than it needs to be.
AP scoring accepts either df, as long as your work shows what you used.

On the TI-84

Press STAT, arrow to TESTS, and choose 0:2-SampTInt. Choose Stats to type in xˉ1\bar{x}_1, s1s_1, n1n_1, xˉ2\bar{x}_2, s2s_2, n2n_2 (or Data if the values are in lists), set the C-Level, and set Pooled: No. The output gives the interval and the df. Pooling assumes the two population standard deviations are equal, which you can rarely justify, so leave it on No.

Example 1: Sleep for juniors and seniors

A teacher at a large high school takes a random sample of 45 of the school's 620 juniors and a separate random sample of 38 of its 590 seniors, and asks each student how many hours they usually sleep on a school night. Juniors: xˉJ=7.1\bar{x}_J = 7.1 hours, sJ=1.2s_J = 1.2 hours. Seniors: xˉS=6.6\bar{x}_S = 6.6 hours, sS=1.5s_S = 1.5 hours. Construct and interpret a 95% confidence interval for the difference in mean hours of sleep.
State: We want to estimate μJ−μS\mu_J - \mu_S with 95% confidence, where μJ\mu_J is the true mean hours of sleep on a school night for all juniors at the school and μS\mu_S is the true mean for all seniors at the school.
Plan: Two-sample tt-interval for μJ−μS\mu_J - \mu_S. Conditions:
  • Randomization: two independent random samples, one of juniors and one of seniors.
  • 10%: 45≤10%(620)=6245 \leq 10\%(620) = 62 and 38≤10%(590)=5938 \leq 10\%(590) = 59.
  • Sample data: nJ=45≥30n_J = 45 \geq 30 and nS=38≥30n_S = 38 \geq 30.
Do: Find the standard error:
SE=1.2245+1.5238=0.0320+0.0592=0.0912≈0.302SE = \sqrt{\frac{1.2^2}{45} + \frac{1.5^2}{38}} = \sqrt{0.0320 + 0.0592} = \sqrt{0.0912} \approx 0.302
The calculator gives df ≈70.49\approx 70.49 and t∗≈1.994t^* \approx 1.994, so the interval is:
(7.1−6.6)±1.994(0.302)=0.5±0.60=(−0.10, 1.10)(7.1 - 6.6) \pm 1.994(0.302) = 0.5 \pm 0.60 = (-0.10,\ 1.10)
Without technology, df =38−1=37= 38 - 1 = 37. That row isn't in Table B, so use the df =30= 30 row: t∗=2.042t^* = 2.042. Then 0.5±2.042(0.302)=0.5±0.620.5 \pm 2.042(0.302) = 0.5 \pm 0.62, or (−0.12,1.12)(-0.12, 1.12), slightly wider.
4.7 - Constructing a Confidence Interval for the Difference Between Two Population Means
Conclude: We are 95% confident that the interval from −0.10-0.10 to 1.101.10 hours captures the true difference in mean hours of sleep on a school night (juniors minus seniors) for all juniors and seniors at this school. The interval includes 0, so these data don't give convincing evidence of a difference in mean sleep between juniors and seniors. Topic 4.8 explains this reasoning.

Example 2: Studying with music (AP-style)

A psychology student recruits 24 volunteers. She randomly assigns 12 of them to study a list of 30 words in silence and the other 12 to study the same list while music plays. After 10 minutes, each person writes down as many words as they remember. The numbers of words recalled:
Group
Words recalled
Silence
18, 16, 21, 17, 19, 15, 20, 22, 17, 18, 19, 16
Music
14, 17, 12, 19, 15, 16, 13, 18, 15, 11, 16, 14
Construct a 95% confidence interval for the difference in mean number of words recalled (silence minus music).
State: We want to estimate μS−μM\mu_S - \mu_M with 95% confidence, where μS\mu_S is the true mean number of words recalled for people like these volunteers who study in silence and μM\mu_M is the true mean for people like these volunteers who study with music.
Plan: Two-sample tt-interval for μS−μM\mu_S - \mu_M. Conditions:
  • Randomization: the two treatments were randomly assigned to the volunteers. This is a randomized experiment, so the 10% condition isn't needed.
  • Sample data: each group has only 12 values, fewer than 30, so check graphs of both samples. The dotplots show no strong skewness and no outliers in either group.
4.7 - Constructing a Confidence Interval for the Difference Between Two Population Means
Do: Put each group in a list and run 2-SampTInt with Data. The summary statistics are xˉS≈18.17\bar{x}_S \approx 18.17, sS≈2.125s_S \approx 2.125, xˉM=15.00\bar{x}_M = 15.00, and sM≈2.374s_M \approx 2.374 words.
SE=2.125212+2.374212≈0.920SE = \sqrt{\frac{2.125^2}{12} + \frac{2.374^2}{12}} \approx 0.920
With df ≈21.73\approx 21.73 from the calculator, t∗≈2.075t^* \approx 2.075:
(18.17−15.00)±2.075(0.920)=3.17±1.91=(1.26, 5.08)(18.17 - 15.00) \pm 2.075(0.920) = 3.17 \pm 1.91 = (1.26,\ 5.08)
Without technology, df =12−1=11= 12 - 1 = 11 and t∗=2.201t^* = 2.201, which gives 3.17±2.023.17 \pm 2.02, or (1.14,5.19)(1.14, 5.19).
Conclude: We are 95% confident that the interval from 1.26 to 5.08 words captures the true difference in mean number of words recalled (silence minus music) for people like these volunteers. The whole interval is above 0, so the data give convincing evidence that studying in silence leads to more words recalled on average than studying with music. Because the treatments were randomly assigned, this supports a cause-and-effect conclusion, but only for people like these volunteers, since they weren't a random sample from a larger population.

Common mistakes

  • Using a two-sample interval on paired data (or the reverse). Check for natural pairs before choosing.
  • Turning pooling on in the calculator. Leave Pooled: No.
  • Using the largest df by hand. The value n1+n2−2n_1 + n_2 - 2 is the largest possible df, and it makes the interval too narrow. By hand, use the smaller of n1−1n_1 - 1 and n2−1n_2 - 1.
  • Checking the sample data condition for only one group, or writing "n≥30n \geq 30" when one of the samples is smaller than 30.
  • Calling it a zz-interval or using z∗z^*. The population standard deviations are unknown, so it's a tt-interval.
  • Not stating the order of subtraction. Without it, the sign of the interval means nothing.

AP® is a registered trademark of the College Board, which is not affiliated with Dove's Library and was not involved in the production of, and does not endorse, this website.

Providing free, high-quality AP notes to help students succeed, earn college credit, and reach their educational goals, ensuring everyone has access to the resources they need.

© 2026 Standard Learning Group, Inc., which operates Dove's Library. All rights reserved.