Two-Sample t-Procedures for a Difference in Means
Do students recall more words in silence than with music playing? Do Grade 11 students in one school board spend more hours a week on screens than in another? When each group gives you a quantitative measurement, you compare their means. This page puts together two ideas you already know: the one-sample t-test for a mean, and the two-group structure from comparing proportions.
Key ideas
Section titled “Key ideas”The sampling distribution of x̄₁ − x̄₂
Section titled “The sampling distribution of x̄₁ − x̄₂”For independent random samples of sizes and from populations with means , and standard deviations , :
As with proportions, the variances add even though it’s a difference. The distribution is normal if both populations are normal, and approximately normal if and .
The two-sample t-interval
Section titled “The two-sample t-interval”In practice and are unknown, so use and . The standard error is
and the two-sample t-interval for a difference between population means is
Degrees of freedom
Section titled “Degrees of freedom”The two-sample statistic doesn’t follow a t-distribution exactly, but it’s very close to one with a df that technology calculates from the data (2-SampTInt and 2-SampTTest on a TI-84). That df is usually not a whole number, and it always lies between
If you’re working by hand with Table B, you can use the smaller of and . That’s the conservative choice: it gives a slightly larger , so a slightly wider interval and a slightly larger p-value than technology.
Don’t pool
Section titled “Don’t pool”On a TI-84, answer No to “Pooled”. AP Statistics uses the unpooled standard error above, which doesn’t assume the two populations have the same standard deviation. (The pooled t-test used in IB Applications and Interpretation assumes equal variances; it can give quite different results when the samples have very different spreads.)
The two-sample t-test
Section titled “The two-sample t-test”The p-value comes from the t-distribution with the df above.
The conditions
Section titled “The conditions”| Condition | What to check |
|---|---|
| Random | Two independent random samples, or a randomized experiment with two treatments. |
| 10% | For random samples, of population 1 and of population 2. Not needed for an experiment. |
| Normal/Large Sample | Both and , or both populations approximately normal. If either sample is smaller than , graphs of both samples should show no strong skewness and no outliers. |
Two samples or paired?
Section titled “Two samples or paired?”The design decides, not the numbers:
- Two independent samples or groups: different individuals in each group, chosen or assigned separately. Use the two-sample t procedures on this page.
- Paired data: each value in one group is matched with a value in the other (the same person twice, twins, before and after). Use a paired t-test or interval on the differences.
Using two-sample methods on paired data usually throws away the advantage of pairing and makes real effects look like noise (see Example 4).
What you can conclude
Section titled “What you can conclude”The same rules as for proportions: a significant result from a randomized experiment is evidence that the treatment causes the difference (for units like those in the study); a significant result from two random samples shows that the population means differ, but not why. An interval that contains means “no difference” is plausible, not proven.
On the AP exam
Section titled “On the AP exam”Name the procedure (“two-sample t-test for ” or “two-sample t-interval”), define both parameters and the order of subtraction, check conditions for both groups, show the formula with numbers, and report the df you used (from technology, or the conservative df). The formula sheet gives .
Worked examples
Section titled “Worked examples”Example 1: The sampling distribution of the difference
Section titled “Example 1: The sampling distribution of the difference”Apples from Orchard A have mean mass g with standard deviation g; apples from Orchard B have mean mass g with standard deviation g. A buyer takes random samples of apples from A and from B. Find the probability that the sample mean for B is higher than the sample mean for A.
Solution.
Both samples have at least apples, so is approximately normal. “B higher” means :
(This uses , not , because the population standard deviations are known.)
Example 2: A two-sample t-interval
Section titled “Example 2: A two-sample t-interval”A researcher takes independent random samples of Grade 11 students from two large school boards and records each student’s weekly hours of recreational screen time.
| Board 1 | |||
| Board 2 |
Construct and interpret a confidence interval for the difference in mean weekly screen time.
Solution.
State. , where and are the true mean weekly screen times of all Grade 11 students in Board 1 and Board 2. confidence.
Plan. Two-sample t-interval for .
- Random: independent random samples from each board.
- 10%: and are less than of the Grade 11 students in each large board.
- Normal/Large Sample: and .
Do.
Technology gives and :
Conclude. We are confident that the interval from to hours captures the true difference (Board 1 minus Board 2) in mean weekly screen time for Grade 11 students. Because the whole interval is above , there is convincing evidence that Board 1’s students have a higher mean screen time.
(With the conservative , and the interval is : very slightly wider, same conclusion.)
Example 3: A test from a small experiment
Section titled “Example 3: A test from a small experiment”A psychology class randomly assigns student volunteers to study a list of words either in silence or with music playing, in each group. The numbers of words recalled are shown.
At , do the data give convincing evidence that students like these recall more words, on average, in silence?
Solution.
State. and are the true mean numbers of words recalled by students like these in silence and with music.
Plan. Two-sample t-test for .
- Random: the conditions were randomly assigned. (The 10% condition isn’t needed for an experiment.)
- Normal/Large Sample: both groups have only students, but the dotplots show no strong skewness and no outliers in either group.
Do. Silence: , . Music: , .
Conclude. Because , we reject . There is convincing evidence that students like these recall more words, on average, when studying in silence than with music. Because the conditions were randomly assigned, this suggests that the music causes lower recall for volunteers like these.
Example 4: Why the design matters
Section titled “Example 4: Why the design matters”On the one-sample t-test page, students each did a reaction-time test in silence and with music. The paired t-test gave and a p-value of . What happens if you wrongly treat the two lists as independent samples?
Solution. Silence: , ; music: , (ms). A two-sample t-test of gives
That’s no evidence at all, even though music slowed of the students. The two-sample standard error includes the big differences between students (some are just faster than others). Pairing removes them, because each student is compared with themself. Since these data are paired, the paired test is the right one.
Common mistakes
Section titled “Common mistakes”Using a two-sample procedure on paired data (or the reverse). Look at the design. Same individuals measured twice, or matched pairs, means paired. Separate groups means two-sample.
Pooling the standard deviations. AP Statistics uses . Choose “Pooled: No” on the calculator.
Subtracting inside the square root. It’s always : the variability of a difference is bigger than the variability of either mean.
Using df = n₁ + n₂ − 2. That’s the upper limit and belongs to the pooled test. Use the df from technology, or the conservative smaller of and .
Checking only one group. If either sample is smaller than , you need to check the graphs of both samples for strong skewness and outliers.
Concluding cause from two random samples. Two boards with different mean screen times doesn’t mean the board causes the difference. Only random assignment supports “causes”.
Practice
Section titled “Practice”1. (Warm-up) Independent random samples give , , and , , . Find the point estimate of and its standard error.
Solution
Point estimate: .
2. (Warm-up) Two samples have sizes and . Between which two values must the technology df for a two-sample t procedure lie? What is the conservative df?
Solution
Between the smaller of and , which is , and . The conservative df is .
3. (Warm-up) Say whether each study calls for a two-sample t procedure or a paired t procedure.
- (a) The heights of randomly chosen maple trees and randomly chosen oak trees in a park.
- (b) The blood pressure of patients before and after a new medication.
- (c) pairs of twins, with one twin in each pair randomly assigned to a new reading program.
Solution
(a) Two-sample: separate random samples of two kinds of trees.
(b) Paired: each patient is measured twice.
(c) Paired: each twin is matched with the other twin in the pair.
4. (Core) A researcher takes independent random samples of commuters in two large cities and records one-way commute times (in minutes). City P: , , . City Q: , , . Construct and interpret a confidence interval for the difference in mean commute time (P Q).
Solution
State. : the difference in the true mean one-way commute times of all commuters in City P and City Q. confidence.
Plan. Two-sample t-interval. Independent random samples; each sample is less than of the commuters in a large city; both samples have at least commuters.
Do.
Technology: , .
Conclude. We are confident that the interval from to minutes captures the true difference (P minus Q) in mean commute time. All values are positive, so there is convincing evidence that commuters in City P have a longer mean commute.
5. (Core) A university compares the mean GPA of first-year students who live in residence with those who live off campus, using independent random samples: residence , , ; off campus , , . At , is there convincing evidence that the mean GPAs differ?
Solution
State. and : the true mean GPAs of all first-year students who live in residence and off campus. , , .
Plan. Two-sample t-test. Independent random samples; each is less than of its group; both samples are at least .
Do.
Conclude. Because , fail to reject . There is not convincing evidence that the mean GPAs of first-year students in residence and off campus differ.
6. (Core) Commute times in City A have mean minutes and standard deviation minutes; in City B, mean minutes and standard deviation minutes. Random samples of commuters from A and from B are taken.
- (a) Find the mean and standard deviation of .
- (b) Find the probability that is more than minutes.
Solution
(a) and
(b) Both samples are at least , so the distribution is approximately normal.
7. (Core) A confidence interval for , the difference in mean daily water use (litres) between households with and without a water-saving rebate, is . The households were random samples from each group, not randomly assigned. Interpret the interval, and explain what it does and doesn’t show.
Solution
We are confident that the interval from to litres captures the true difference (rebate minus no rebate) in mean daily water use. Because it contains , there is no convincing evidence that the means differ. It doesn’t show the means are equal: rebate households could use up to L less or up to L more per day. And even if the interval excluded , households chose whether to get the rebate, so we couldn’t say the rebate caused a difference.
8. (Challenge) Independent random samples give , , and , , , and both samples show no strong skewness or outliers. Construct a confidence interval for using (a) the technology df and (b) the conservative df. Compare.
Solution
and the point estimate is .
(a) Technology: , . , giving .
(b) Conservative: , . , giving .
The conservative interval is a little wider, because it uses fewer df and so a bigger . Both contain , so neither gives convincing evidence of a difference.
9. (Challenge) Two samples have , , and , , .
- (a) Find the unpooled two-sample statistic and its two-sided p-value (technology df ).
- (b) The pooled standard deviation is , and the pooled test uses with df. Find and the p-value.
- (c) Explain why the results are so different, and which one AP Statistics expects.
Solution
(a)
(b)
(c) Pooling assumes both populations have the same standard deviation, so it mixes the small spread of sample 1 () with the large spread of the bigger sample 2 (), which dominates. That overstates the variability of . The spreads here are very different, so the equal-variance assumption is doubtful. AP Statistics expects the unpooled test, (a).
Homework
Section titled “Homework”Try these independently after the practice questions. Show your setup and explain your reasoning. Check every condition for both groups, state the df you used, and write every conclusion in context. Homework solutions are not provided on the published site.
All data in these questions are hypothetical.
Foundations
Section titled “Foundations”H1. (Foundations) For each study, say whether a two-sample or a paired procedure fits, define the parameter(s), and write the hypotheses.
- (a) A gym compares the mean number of visits per month for members on a monthly plan and on an annual plan, using a random sample from each plan, to see whether they differ.
- (b) A coach records each of swimmers’ times before and after a six-week training block, expecting times to fall.
H2. (Foundations) Independent random samples give , , and , , . Find the standard error, the two-sample statistic, and the range of possible df.
H3. (Core) A library compares how long (in minutes) visitors stay at two branches, using independent random samples: downtown , , ; suburban , , . At , is there convincing evidence that visitors stay longer, on average, at the downtown branch?
H4. (Core) A reviewer measures the battery life (in hours) of random samples of two phone models:
Check the conditions, then construct and interpret a confidence interval for the difference in mean battery life (A B).
H5. (Core) Scores on a provincial reading test have mean and standard deviation at School 1, and mean and standard deviation at School 2. Random samples of students from School 1 and from School 2 are taken. Find the probability that the School 2 sample mean is higher than the School 1 sample mean.
H6. (Core) A study randomly assigns volunteers to a new sleep app or no app for a month, and a two-sample t-test of whether the app increases mean nightly sleep gives and p-value .
- (a) Interpret the p-value in context.
- (b) What can you conclude about cause and effect? About which people?
Challenge
Section titled “Challenge”H7. (Challenge) Ten volunteers each type the same passage on two keyboard layouts, in a random order. Their times (in minutes) are:
| Volunteer | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Layout A | 18.2 | 21.5 | 15.4 | 19.8 | 22.1 | 17.3 | 20.6 | 16.8 | 23.0 | 18.9 |
| Layout B | 16.9 | 20.8 | 14.1 | 19.2 | 21.0 | 16.8 | 19.5 | 16.3 | 22.2 | 17.6 |
- (a) A student runs a two-sample t-test of against and gets a p-value of . Explain why this is the wrong analysis.
- (b) Carry out the correct test at .
- (c) Explain why the two analyses give such different p-values.
H8. (Challenge) Independent random samples give , , and , , ; both samples show no strong skewness or outliers.
- (a) Construct a confidence interval for using the technology df ().
- (b) Repeat with the conservative df.
- (c) Does either interval give convincing evidence that the means differ?
H9. (Challenge) A researcher compares two groups. Group 1 has observations, and a boxplot shows one outlier. Group 2 has observations and is strongly skewed. She says: “Group 2 has at least , so the Normal/Large Sample condition is met.” Is she right? Explain what the condition requires here.
H10. (Challenge) A report gives a two-sample t-interval of for , using degrees of freedom.
- (a) Find the point estimate and the standard error.
- (b) Find the test statistic and p-value for against , and check that the decision at agrees with the interval.