One-Sample t-Test and Paired Data
A cereal box says g. Is the factory really filling boxes to g on average, or is it shorting customers? Questions about a mean need a different test from questions about a proportion, because you almost never know the population standard deviation. The one-sample t-test handles that, and with one clever step it also handles “before and after” data. The steps are the same as the test for a proportion; the interval version is on confidence intervals for the mean.
Key ideas
Section titled “Key ideas”Why t instead of z
Section titled “Why t instead of z”If you knew the population standard deviation , the standardized sample mean would follow a standard normal distribution. In practice is unknown, so you replace it with the sample standard deviation . The result,
has a t-distribution with degrees of freedom (df). Using adds extra variability, because itself changes from sample to sample.
Fatter tails mean bigger critical values: for confidence, but with df and with df. The AP formula sheet has a t-table (Table B) of critical values by df and tail probability; on a TI-84, invT(area to the left, df) gives and tcdf gives tail areas.
Hypotheses
Section titled “Hypotheses”Define in context: the mean of what, for which population.
The conditions
Section titled “The conditions”| Condition | What to check |
|---|---|
| Random | A random sample, or a randomized experiment. |
| 10% | When sampling without replacement, of the population. |
| Normal/Large Sample | The population is approximately normal, or , or (if and the population shape is unknown) a graph of the sample data shows no strong skewness and no outliers. |
For a small sample, actually look at the data: make a dotplot, boxplot, or stemplot and say what you see. “The dotplot shows no strong skewness or outliers” is the kind of sentence AP graders expect. You can also check for outliers with the rule from quartiles and percentiles.
The test statistic and p-value
Section titled “The test statistic and p-value”The one-sample t-test for a population mean uses
The denominator is the standard error of . The p-value is a tail area of the t-distribution in the direction of (both tails for ), found with tcdf or T-Test on a TI-84. Interpret it and conclude exactly as for proportions:
Assuming [, in context], there is a [p-value] probability of getting a sample mean of [] or [more extreme] by chance alone.
Paired data: test the differences
Section titled “Paired data: test the differences”Sometimes the data come in pairs: the same person measured twice (before and after, or under two conditions), or two matched individuals. The two measurements in a pair are related, so they aren’t two independent samples. Instead:
- Subtract within each pair to get one list of differences, and say the order (for example, “music silence”).
- Let be the true mean difference. Test against , , or .
- Run a one-sample t-test on the differences:
where , , and are the mean, standard deviation, and number of the differences. Check the Normal/Large Sample condition on the differences, not on the original measurements.
A paired t-interval works the same way: with df.
Pairing is powerful: each subject acts as their own comparison, so differences between subjects (some people are just faster than others) cancel out.
Tests and intervals agree
Section titled “Tests and intervals agree”For a mean, a two-sided t-test at significance level and a confidence interval use the same standard error and the same t-distribution. So the test rejects exactly when is outside the interval. (For proportions they could disagree slightly; for means they can’t.)
On the AP exam
Section titled “On the AP exam”Name the procedure exactly: “one-sample t-test for a population mean” or “paired t-test for a mean difference” (also called a one-sample t-test for ). Check the conditions in context, show with numbers, state df and the p-value, and conclude in context in terms of . For paired data, the parameter must include the order of subtraction.
Worked examples
Section titled “Worked examples”Example 1: Choosing the procedure
Section titled “Example 1: Choosing the procedure”Which procedure fits each study? Define the parameter.
- (a) A random sample of cereal boxes is weighed to check the mean against the labelled g.
- (b) Ten students each do a reaction-time test twice, once with music and once in silence, in a random order.
Solution.
(a) One-sample t-test for a population mean. = the true mean mass of all boxes of this cereal from the factory.
(b) Paired t-test. Each student gives two related measurements, so take differences (music silence). = the true mean difference in reaction time (music minus silence) for students like these.
Example 2: A one-sided test from summary statistics
Section titled “Example 2: A one-sided test from summary statistics”The boxes in Example 1(a), a random sample from a large production run, have a mean mass of g and a standard deviation of g. At , is there convincing evidence that the true mean mass is less than g?
Solution.
State. = the true mean mass of all boxes in the production run.
Plan. One-sample t-test for .
- Random: a random sample of boxes.
- 10%: is less than of a large production run.
- Normal/Large Sample: .
Do.
Conclude. Because , we reject . There is convincing evidence that the true mean mass of boxes in this production run is less than g.
Example 3: A two-sided test from raw data
Section titled “Example 3: A two-sided test from raw data”A transit agency says the mean wait for a certain bus is minutes. A rider records the wait times (in minutes) on randomly chosen days:
At , do the data give convincing evidence that the true mean wait is different from minutes?
Solution.
State. = the true mean wait time for this bus. , , .
Plan. One-sample t-test for .
- Random: randomly chosen days.
- 10%: days is less than of all days the bus runs.
- Normal/Large Sample: , so check the data. The five-number summary is , , , , , so and the outlier fences are and . No value is outside them, and the mean () is close to the median (), so there’s no strong skewness and no outliers.
Do. From the data, and .
Conclude. Because , we fail to reject . There is not convincing evidence that the true mean wait for this bus is different from minutes. (It’s close; a larger sample might settle it.)
Example 4: Paired data
Section titled “Example 4: Paired data”The ten students in Example 1(b) are a random sample from a large school. Their reaction times (in milliseconds) are:
| Student | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Silence | 312 | 298 | 335 | 287 | 320 | 305 | 341 | 293 | 316 | 308 |
| Music | 325 | 301 | 349 | 290 | 334 | 312 | 350 | 297 | 330 | 307 |
- (a) At , is there convincing evidence that music increases mean reaction time?
- (b) Construct and interpret a confidence interval for the mean difference.
Solution.
The differences (music silence) are
with ms, ms, and .
(a) State. = the true mean difference in reaction time (music minus silence) for students at the school. , , .
Plan. Paired t-test. Random: random sample of students, and the order of the two conditions was randomized. 10%: is less than of a large school. Normal/Large Sample: , but the differences range from to , with five-number summary , , , , : no outliers (fences and ) and no strong skewness.
Do.
Conclude. Because , we reject . There is convincing evidence that music increases the mean reaction time for students at this school.
(b) With df, :
We are confident that the interval from to ms captures the true mean difference in reaction time (music minus silence) for students at this school. The whole interval is above , which agrees with the test.
Common mistakes
Section titled “Common mistakes”Using z when only s is known. If the standard deviation came from the sample, use with df, not the normal distribution, even for large samples.
Getting the degrees of freedom wrong. For a one-sample or paired t-test, , where is the number of observations (or the number of pairs, not the total number of measurements).
Treating paired data as two independent samples. If each value in one list is matched to a value in the other (the same person, the same day, a matched partner), analyze the differences.
Checking the condition on the wrong data. For paired data, the Normal/Large Sample condition is about the differences. And for a small sample, don’t just say “Normal”: describe the graph of the data you looked at.
Thinking n ≥ 30 makes the data normal. A large sample makes the sampling distribution of approximately normal (the central limit theorem). The data themselves can still be skewed.
Leaving out the order of subtraction. "" means nothing unless you’ve said which measurement is subtracted from which.
Practice
Section titled “Practice”1. (Warm-up) Find the critical value for (a) confidence with observations, (b) confidence with observations, and (c) confidence with observations.
Solution
(a) df : .
(b) df : .
(c) df : .
2. (Warm-up) Say whether a one-sample t-test or a paired t-test fits, and define the parameter.
- (a) Twelve volunteers’ resting heart rates are measured before and after a month of yoga.
- (b) A random sample of new cars is tested to see whether their mean fuel use differs from the L/100 km on the label.
Solution
(a) Paired t-test on the differences (after before). = the true mean change in resting heart rate (after minus before) for people like these volunteers.
(b) One-sample t-test. = the true mean fuel use (L/100 km) of all new cars of this model.
3. (Warm-up) A random sample of gives and . Find the test statistic, df, and p-value for against .
Solution
4. (Core) A bakery chain says its sourdough loaves have a mean mass of g. An inspector weighs a random sample of loaves from a day’s large production and finds g and g. At , is there convincing evidence that the true mean mass is different from g?
Solution
State. = the true mean mass of the day’s sourdough loaves. , , .
Plan. One-sample t-test for . Random sample; is less than of a large day’s production; .
Do.
Conclude. Because , reject . There is convincing evidence that the true mean mass of the day’s loaves is different from g (the sample suggests it is lower).
5. (Core) A student wants to use a one-sample t-test on the masses (in kg) of randomly chosen bags of flour:
Is the Normal/Large Sample condition met? Explain.
Solution
No. The sample is small () and the population shape is unknown, so the data must show no strong skewness or outliers. The five-number summary is , , , , ; , so the upper fence is . The value is far above it, so it’s an outlier and the condition is not met. (The student should check whether is a recording error before doing anything else.)
6. (Core) Fifteen randomly selected students take a practice test, attend a review session, then take a similar test. The improvements (after before) have mean points and standard deviation points, and a dotplot shows no strong skewness or outliers. At , is there convincing evidence that the review session raises mean scores?
Solution
State. = the true mean improvement (after minus before) for students like these. , , .
Plan. Paired t-test. Random sample of students; is less than of all students; the differences show no strong skewness or outliers.
Do.
Conclude. Because , reject . There is convincing evidence that the mean score is higher after the review session. (There was no control group, so other things that changed between the tests, such as practice from the first test, could also explain the improvement.)
7. (Core) For the test in Question 4:
- (a) Interpret the p-value in context.
- (b) Which type of error could the inspector have made? Describe it in context.
Solution
(a) Assuming the true mean mass of the day’s loaves is g, there is a probability of getting a sample mean at least as far from g as g (in either direction) in a random sample of loaves, by chance alone.
(b) A Type I error (the inspector rejected ): concluding that the mean mass is different from g when it really is g.
8. (Challenge) From a random sample of , a t-interval for is .
- (a) Without calculating, predict the decision of a two-sided test at for and for .
- (b) Find and the standard error, then calculate the test statistic and p-value for .
Solution
(a) is outside the interval, so reject . is inside, so fail to reject . (For means, the two methods always agree.)
(b) and the margin of error is . With df, , so .
: reject, as predicted.
9. (Challenge) A random sample of gives . For a test of against at , what is the largest sample standard deviation for which the result is significant? Explain why a smaller makes the result more convincing.
Solution
With df, the one-sided critical value is . Significant when
A smaller means less variability in the data, so a -point gap between and is less likely to be just chance: the same difference is more standard errors away from .
Homework
Section titled “Homework”Try these independently after the practice questions. Show your setup and explain your reasoning. Check every condition in context (describe the data for small samples), and write every conclusion in context in terms of the alternative hypothesis. Homework solutions are not provided on the published site.
All data in these questions are hypothetical.
Foundations
Section titled “Foundations”H1. (Foundations) Say whether a one-sample t-test or a paired t-test fits, define the parameter, and write the hypotheses.
- (a) A phone maker claims its battery lasts hours on average. A reviewer suspects the true mean is lower and tests a random sample of phones.
- (b) A tutor wants to know whether students’ quiz scores change after six tutoring sessions, so she records each student’s score before and after.
H2. (Foundations) A random sample of gives and , and the data show no strong skewness or outliers. Find the test statistic, df, and p-value for against , and state the decision at .
H3. (Core) Health guidelines recommend at least hours of sleep a night for teens. A random sample of Grade 12 students at a large school recorded their hours of sleep on a school night:
At , do the data give convincing evidence that the true mean sleep for Grade 12 students at the school is less than hours?
H4. (Core) For your test in H3:
- (a) Interpret the p-value in context.
- (b) Which type of error could have been made? Describe it in context.
H5. (Core) Eight runners each ran km twice, once in shoe A and once in shoe B, in a random order. Their times (in minutes) were:
| Runner | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Shoe A | 24.1 | 26.3 | 22.8 | 28.5 | 25.0 | 23.7 | 27.2 | 24.9 |
| Shoe B | 23.6 | 25.9 | 22.9 | 27.6 | 24.2 | 23.5 | 26.4 | 24.1 |
- (a) At , is there convincing evidence that the mean times differ for the two shoes?
- (b) Construct and interpret a confidence interval for the mean difference (A B).
H6. (Core) For each situation, say whether the Normal/Large Sample condition for a one-sample t-test is met. Explain.
- (a) A random sample of household incomes; a histogram is strongly skewed right.
- (b) A random sample of commute times; a boxplot shows one outlier far above the rest.
- (c) A random sample of apple masses; a dotplot is roughly symmetric with no gaps or outliers.
Challenge
Section titled “Challenge”H7. (Challenge) Twenty students each took a fitness test in September and again in January. A student analyzed the data like this:
September: , January: . Population standard deviation , so , with df .
Identify three errors, and describe the correct analysis.
H8. (Challenge) A researcher expects and . What is the smallest sample size for which a two-sided t-test at would reject (if those values occur exactly)? Explain why you can’t just use to find it.
H9. (Challenge) Show that a two-sided one-sample t-test at level rejects exactly when lies outside the confidence interval .
H10. (Challenge) A random sample of lab reaction yields (in %) is:
The target mean is , and the lab wants evidence that the true mean is higher.
- (a) Explain why the Normal/Large Sample condition is not met.
- (b) Find the t-statistic and p-value using all values, and again without .
- (c) The outlier made the sample mean bigger but the p-value larger. Explain why. What should the lab do about the value ?