Skip to content
Family Table Math
Auto

One-Sample t-Test and Paired Data

A cereal box says 500500 g. Is the factory really filling boxes to 500500 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.

If you knew the population standard deviation σ\sigma, the standardized sample mean xˉ−μσ/n\dfrac{\bar{x} - \mu}{\sigma/\sqrt{n}} would follow a standard normal distribution. In practice σ\sigma is unknown, so you replace it with the sample standard deviation ss. The result,

t=xˉ−μs/nt = \frac{\bar{x} - \mu}{s/\sqrt{n}}

has a t-distribution with n−1n - 1 degrees of freedom (df). Using ss adds extra variability, because ss itself changes from sample to sample.

The standard normal curve, dashed, with two t-distributions. The t-distribution with 10 degrees of freedom is almost the same as the normal curve. The t-distribution with 2 degrees of freedom has a lower peak and fatter tails. −3 −2 −1 0 1 2 3 standard normal t, df = 10 t, df = 2 (fatter tails)
t-distributions are symmetric and bell-shaped, centred at 00, with fatter tails than the standard normal. As df increases, they get closer to the normal curve.

Fatter tails mean bigger critical values: for 95%95\% confidence, z∗=1.960z^* = 1.960 but t∗=2.262t^* = 2.262 with 99 df and 2.0452.045 with 2929 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 t∗t^* and tcdf gives tail areas.

H0:μ=μ0Ha:μ>μ0,μ<μ0,orμ≠μ0H_0: \mu = \mu_0 \qquad H_a: \mu \gt \mu_0, \quad \mu \lt \mu_0, \quad \text{or} \quad \mu \ne \mu_0

Define μ\mu in context: the mean of what, for which population.

ConditionWhat to check
RandomA random sample, or a randomized experiment.
10%When sampling without replacement, n≤10%n \le 10\% of the population.
Normal/Large SampleThe population is approximately normal, or n≥30n \ge 30, or (if n<30n \lt 30 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 1.5×IQR1.5 \times IQR rule from quartiles and percentiles.

The one-sample t-test for a population mean uses

t=xˉ−μ0s/ndf=n−1t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}} \qquad \text{df} = n - 1

The denominator sn\dfrac{s}{\sqrt{n}} is the standard error of xˉ\bar{x}. The p-value is a tail area of the t-distribution in the direction of HaH_a (both tails for ≠\ne), found with tcdf or T-Test on a TI-84. Interpret it and conclude exactly as for proportions:

Assuming [μ=μ0\mu = \mu_0, in context], there is a [p-value] probability of getting a sample mean of [xˉ\bar{x}] or [more extreme] by chance alone.

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:

  1. Subtract within each pair to get one list of differences, and say the order (for example, “music −- silence”).
  2. Let μd\mu_d be the true mean difference. Test H0:μd=0H_0: \mu_d = 0 against Ha:μd>0H_a: \mu_d \gt 0, μd<0\mu_d \lt 0, or μd≠0\mu_d \ne 0.
  3. Run a one-sample t-test on the differences:
t=xˉd−0sd/nddf=nd−1t = \frac{\bar{x}_d - 0}{s_d/\sqrt{n_d}} \qquad \text{df} = n_d - 1

where xˉd\bar{x}_d, sds_d, and ndn_d 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: xˉd±t∗sdnd\bar{x}_d \pm t^*\dfrac{s_d}{\sqrt{n_d}} with nd−1n_d - 1 df.

Pairing is powerful: each subject acts as their own comparison, so differences between subjects (some people are just faster than others) cancel out.

For a mean, a two-sided t-test at significance level α\alpha and a (1−α)(1 - \alpha) confidence interval use the same standard error and the same t-distribution. So the test rejects H0:μ=μ0H_0: \mu = \mu_0 exactly when μ0\mu_0 is outside the interval. (For proportions they could disagree slightly; for means they can’t.)

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 μd\mu_d). Check the conditions in context, show t=xˉ−μ0s/nt = \dfrac{\bar{x} - \mu_0}{s/\sqrt{n}} with numbers, state df and the p-value, and conclude in context in terms of HaH_a. For paired data, the parameter must include the order of subtraction.

Which procedure fits each study? Define the parameter.

  • (a) A random sample of 4040 cereal boxes is weighed to check the mean against the labelled 500500 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. μ\mu = 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). μd\mu_d = 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 4040 boxes in Example 1(a), a random sample from a large production run, have a mean mass of xˉ=497.8\bar{x} = 497.8 g and a standard deviation of s=6.1s = 6.1 g. At α=0.05\alpha = 0.05, is there convincing evidence that the true mean mass is less than 500500 g?

Solution.

State. μ\mu = the true mean mass of all boxes in the production run.

H0:μ=500Ha:μ<500α=0.05H_0: \mu = 500 \qquad H_a: \mu \lt 500 \qquad \alpha = 0.05

Plan. One-sample t-test for μ\mu.

  • Random: a random sample of boxes.
  • 10%: 4040 is less than 10%10\% of a large production run.
  • Normal/Large Sample: n=40≥30n = 40 \ge 30.

Do.

t=497.8−5006.1/40=−2.20.9645=−2.28df=39p-value=P(t≤−2.28)=0.0140\begin{aligned} t &= \frac{497.8 - 500}{6.1/\sqrt{40}} = \frac{-2.2}{0.9645} = -2.28 \qquad \text{df} = 39 \\ \text{p-value} &= P(t \le -2.28) = 0.0140 \end{aligned}

Conclude. Because 0.0140<0.050.0140 \lt 0.05, we reject H0H_0. There is convincing evidence that the true mean mass of boxes in this production run is less than 500500 g.

A transit agency says the mean wait for a certain bus is 1010 minutes. A rider records the wait times (in minutes) on 1212 randomly chosen days:

12.18.414.69.911.213.57.810.912.815.19.311.712.1 \quad 8.4 \quad 14.6 \quad 9.9 \quad 11.2 \quad 13.5 \quad 7.8 \quad 10.9 \quad 12.8 \quad 15.1 \quad 9.3 \quad 11.7

At α=0.05\alpha = 0.05, do the data give convincing evidence that the true mean wait is different from 1010 minutes?

Solution.

State. μ\mu = the true mean wait time for this bus. H0:μ=10H_0: \mu = 10, Ha:μ≠10H_a: \mu \ne 10, α=0.05\alpha = 0.05.

Plan. One-sample t-test for μ\mu.

  • Random: randomly chosen days.
  • 10%: 1212 days is less than 10%10\% of all days the bus runs.
  • Normal/Large Sample: n=12<30n = 12 \lt 30, so check the data. The five-number summary is 7.87.8, 9.69.6, 11.4511.45, 13.1513.15, 15.115.1, so IQR=3.55IQR = 3.55 and the outlier fences are 9.6−1.5(3.55)=4.2759.6 - 1.5(3.55) = 4.275 and 13.15+1.5(3.55)=18.47513.15 + 1.5(3.55) = 18.475. No value is outside them, and the mean (11.4411.44) is close to the median (11.4511.45), so there’s no strong skewness and no outliers.

Do. From the data, xˉ=11.44\bar{x} = 11.44 and s=2.331s = 2.331.

t=11.44−102.331/12=1.440.673=2.14df=11p-value=2P(t≥2.14)=0.0554\begin{aligned} t &= \frac{11.44 - 10}{2.331/\sqrt{12}} = \frac{1.44}{0.673} = 2.14 \qquad \text{df} = 11 \\ \text{p-value} &= 2P(t \ge 2.14) = 0.0554 \end{aligned}

Conclude. Because 0.0554>0.050.0554 \gt 0.05, we fail to reject H0H_0. There is not convincing evidence that the true mean wait for this bus is different from 1010 minutes. (It’s close; a larger sample might settle it.)

The ten students in Example 1(b) are a random sample from a large school. Their reaction times (in milliseconds) are:

Student12345678910
Silence312298335287320305341293316308
Music325301349290334312350297330307
  • (a) At α=0.05\alpha = 0.05, is there convincing evidence that music increases mean reaction time?
  • (b) Construct and interpret a 95%95\% confidence interval for the mean difference.

Solution.

The differences (music −- silence) are

1331431479414−113 \quad 3 \quad 14 \quad 3 \quad 14 \quad 7 \quad 9 \quad 4 \quad 14 \quad -1

with xˉd=8.0\bar{x}_d = 8.0 ms, sd=5.598s_d = 5.598 ms, and nd=10n_d = 10.

(a) State. μd\mu_d = the true mean difference in reaction time (music minus silence) for students at the school. H0:μd=0H_0: \mu_d = 0, Ha:μd>0H_a: \mu_d \gt 0, α=0.05\alpha = 0.05.

Plan. Paired t-test. Random: random sample of students, and the order of the two conditions was randomized. 10%: 1010 is less than 10%10\% of a large school. Normal/Large Sample: nd=10<30n_d = 10 \lt 30, but the differences range from −1-1 to 1414, with five-number summary −1-1, 33, 88, 1414, 1414: no outliers (fences −13.5-13.5 and 30.530.5) and no strong skewness.

Do.

t=8.0−05.598/10=8.01.770=4.52df=9p-value=P(t≥4.52)=0.0007\begin{aligned} t &= \frac{8.0 - 0}{5.598/\sqrt{10}} = \frac{8.0}{1.770} = 4.52 \qquad \text{df} = 9 \\ \text{p-value} &= P(t \ge 4.52) = 0.0007 \end{aligned}

Conclude. Because 0.0007<0.050.0007 \lt 0.05, we reject H0H_0. There is convincing evidence that music increases the mean reaction time for students at this school.

(b) With 99 df, t∗=2.262t^* = 2.262:

8.0±2.262(5.59810)=8.0±4.00⇒(4.0, 12.0)8.0 \pm 2.262\left(\frac{5.598}{\sqrt{10}}\right) = 8.0 \pm 4.00 \quad\Rightarrow\quad (4.0,\ 12.0)

We are 95%95\% confident that the interval from 4.04.0 to 12.012.0 ms captures the true mean difference in reaction time (music minus silence) for students at this school. The whole interval is above 00, which agrees with the test.

Using z when only s is known. If the standard deviation came from the sample, use tt with n−1n - 1 df, not the normal distribution, even for large samples.

Getting the degrees of freedom wrong. For a one-sample or paired t-test, df=n−1\text{df} = n - 1, where nn 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 xˉ\bar{x} approximately normal (the central limit theorem). The data themselves can still be skewed.

Leaving out the order of subtraction. "μd>0\mu_d \gt 0" means nothing unless you’ve said which measurement is subtracted from which.

1. (Warm-up) Find the critical value t∗t^* for (a) 95%95\% confidence with 1515 observations, (b) 99%99\% confidence with 88 observations, and (c) 90%90\% confidence with 4141 observations.

Solution

(a) df =14= 14: t∗=2.145t^* = 2.145.

(b) df =7= 7: t∗=3.499t^* = 3.499.

(c) df =40= 40: t∗=1.684t^* = 1.684.

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 5050 new cars is tested to see whether their mean fuel use differs from the 7.27.2 L/100 km on the label.
Solution

(a) Paired t-test on the differences (after −- before). μd\mu_d = the true mean change in resting heart rate (after minus before) for people like these volunteers.

(b) One-sample t-test. μ\mu = the true mean fuel use (L/100 km) of all new cars of this model.

3. (Warm-up) A random sample of 2525 gives xˉ=52.3\bar{x} = 52.3 and s=4.8s = 4.8. Find the test statistic, df, and p-value for H0:μ=50H_0: \mu = 50 against Ha:μ>50H_a: \mu \gt 50.

Solutiont=52.3−504.8/25=2.30.96=2.40df=24p-value=P(t≥2.40)=0.0124t = \frac{52.3 - 50}{4.8/\sqrt{25}} = \frac{2.3}{0.96} = 2.40 \qquad \text{df} = 24 \qquad \text{p-value} = P(t \ge 2.40) = 0.0124

4. (Core) A bakery chain says its sourdough loaves have a mean mass of 680680 g. An inspector weighs a random sample of 3636 loaves from a day’s large production and finds xˉ=676.2\bar{x} = 676.2 g and s=9.5s = 9.5 g. At α=0.05\alpha = 0.05, is there convincing evidence that the true mean mass is different from 680680 g?

Solution

State. μ\mu = the true mean mass of the day’s sourdough loaves. H0:μ=680H_0: \mu = 680, Ha:μ≠680H_a: \mu \ne 680, α=0.05\alpha = 0.05.

Plan. One-sample t-test for μ\mu. Random sample; 3636 is less than 10%10\% of a large day’s production; n=36≥30n = 36 \ge 30.

Do.

t=676.2−6809.5/36=−3.81.583=−2.40df=35p-value=2P(t≤−2.40)=0.0218\begin{aligned} t &= \frac{676.2 - 680}{9.5/\sqrt{36}} = \frac{-3.8}{1.583} = -2.40 \qquad \text{df} = 35 \\ \text{p-value} &= 2P(t \le -2.40) = 0.0218 \end{aligned}

Conclude. Because 0.0218<0.050.0218 \lt 0.05, reject H0H_0. There is convincing evidence that the true mean mass of the day’s loaves is different from 680680 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 1212 randomly chosen bags of flour:

3.12.83.42.93.03.32.73.25.93.02.93.13.1 \quad 2.8 \quad 3.4 \quad 2.9 \quad 3.0 \quad 3.3 \quad 2.7 \quad 3.2 \quad 5.9 \quad 3.0 \quad 2.9 \quad 3.1

Is the Normal/Large Sample condition met? Explain.

Solution

No. The sample is small (n=12<30n = 12 \lt 30) and the population shape is unknown, so the data must show no strong skewness or outliers. The five-number summary is 2.72.7, 2.92.9, 3.053.05, 3.253.25, 5.95.9; IQR=0.35IQR = 0.35, so the upper fence is 3.25+1.5(0.35)=3.7753.25 + 1.5(0.35) = 3.775. The value 5.95.9 is far above it, so it’s an outlier and the condition is not met. (The student should check whether 5.95.9 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 2.42.4 points and standard deviation 3.13.1 points, and a dotplot shows no strong skewness or outliers. At α=0.01\alpha = 0.01, is there convincing evidence that the review session raises mean scores?

Solution

State. μd\mu_d = the true mean improvement (after minus before) for students like these. H0:μd=0H_0: \mu_d = 0, Ha:μd>0H_a: \mu_d \gt 0, α=0.01\alpha = 0.01.

Plan. Paired t-test. Random sample of students; 1515 is less than 10%10\% of all students; the differences show no strong skewness or outliers.

Do.

t=2.4−03.1/15=2.40.800=3.00df=14p-value=P(t≥3.00)=0.0048t = \frac{2.4 - 0}{3.1/\sqrt{15}} = \frac{2.4}{0.800} = 3.00 \qquad \text{df} = 14 \qquad \text{p-value} = P(t \ge 3.00) = 0.0048

Conclude. Because 0.0048<0.010.0048 \lt 0.01, reject H0H_0. 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 680680 g, there is a 0.02180.0218 probability of getting a sample mean at least as far from 680680 g as 676.2676.2 g (in either direction) in a random sample of 3636 loaves, by chance alone.

(b) A Type I error (the inspector rejected H0H_0): concluding that the mean mass is different from 680680 g when it really is 680680 g.

8. (Challenge) From a random sample of 2020, a 95%95\% t-interval for μ\mu is (12.4, 15.8)(12.4,\ 15.8).

  • (a) Without calculating, predict the decision of a two-sided test at α=0.05\alpha = 0.05 for H0:μ=12H_0: \mu = 12 and for H0:μ=14H_0: \mu = 14.
  • (b) Find xˉ\bar{x} and the standard error, then calculate the test statistic and p-value for H0:μ=12H_0: \mu = 12.
Solution

(a) 1212 is outside the interval, so reject H0:μ=12H_0: \mu = 12. 1414 is inside, so fail to reject H0:μ=14H_0: \mu = 14. (For means, the two methods always agree.)

(b) xˉ=12.4+15.82=14.1\bar{x} = \dfrac{12.4 + 15.8}{2} = 14.1 and the margin of error is 1.71.7. With 1919 df, t∗=2.093t^* = 2.093, so SE=1.72.093=0.812SE = \dfrac{1.7}{2.093} = 0.812.

t=14.1−120.812=2.59p-value=2P(t≥2.59)=0.0181t = \frac{14.1 - 12}{0.812} = 2.59 \qquad \text{p-value} = 2P(t \ge 2.59) = 0.0181

0.0181<0.050.0181 \lt 0.05: reject, as predicted.

9. (Challenge) A random sample of 1616 gives xˉ=103.5\bar{x} = 103.5. For a test of H0:μ=100H_0: \mu = 100 against Ha:μ>100H_a: \mu \gt 100 at α=0.05\alpha = 0.05, what is the largest sample standard deviation ss for which the result is significant? Explain why a smaller ss makes the result more convincing.

Solution

With 1515 df, the one-sided 5%5\% critical value is t∗=1.753t^* = 1.753. Significant when

103.5−100s/16≥1.753⇒14s≥1.753⇒s≤7.986\frac{103.5 - 100}{s/\sqrt{16}} \ge 1.753 \quad\Rightarrow\quad \frac{14}{s} \ge 1.753 \quad\Rightarrow\quad s \le 7.986

A smaller ss means less variability in the data, so a 3.53.5-point gap between xˉ\bar{x} and 100100 is less likely to be just chance: the same difference is more standard errors away from μ0\mu_0.

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.

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 2020 hours on average. A reviewer suspects the true mean is lower and tests a random sample of 3535 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 1818 gives xˉ=7.6\bar{x} = 7.6 and s=1.9s = 1.9, and the data show no strong skewness or outliers. Find the test statistic, df, and p-value for H0:μ=7H_0: \mu = 7 against Ha:μ≠7H_a: \mu \ne 7, and state the decision at α=0.05\alpha = 0.05.

H3. (Core) Health guidelines recommend at least 88 hours of sleep a night for teens. A random sample of 1010 Grade 12 students at a large school recorded their hours of sleep on a school night:

7.26.58.16.87.56.97.86.27.17.47.2 \quad 6.5 \quad 8.1 \quad 6.8 \quad 7.5 \quad 6.9 \quad 7.8 \quad 6.2 \quad 7.1 \quad 7.4

At α=0.05\alpha = 0.05, do the data give convincing evidence that the true mean sleep for Grade 12 students at the school is less than 88 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 55 km twice, once in shoe A and once in shoe B, in a random order. Their times (in minutes) were:

Runner12345678
Shoe A24.126.322.828.525.023.727.224.9
Shoe B23.625.922.927.624.223.526.424.1
  • (a) At α=0.05\alpha = 0.05, is there convincing evidence that the mean times differ for the two shoes?
  • (b) Construct and interpret a 95%95\% 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 4040 household incomes; a histogram is strongly skewed right.
  • (b) A random sample of 1212 commute times; a boxplot shows one outlier far above the rest.
  • (c) A random sample of 1515 apple masses; a dotplot is roughly symmetric with no gaps or outliers.

H7. (Challenge) Twenty students each took a fitness test in September and again in January. A student analyzed the data like this:

September: xˉ=31.2\bar{x} = 31.2, January: xˉ=33.0\bar{x} = 33.0. Population standard deviation σ≈s=6\sigma \approx s = 6, so z=33.0−31.26/20=1.34z = \dfrac{33.0 - 31.2}{6/\sqrt{20}} = 1.34, with df =40−1=39= 40 - 1 = 39.

Identify three errors, and describe the correct analysis.

H8. (Challenge) A researcher expects xˉ−μ0≈2\bar{x} - \mu_0 \approx 2 and s≈8s \approx 8. What is the smallest sample size for which a two-sided t-test at α=0.05\alpha = 0.05 would reject H0H_0 (if those values occur exactly)? Explain why you can’t just use z∗=1.96z^* = 1.96 to find it.

H9. (Challenge) Show that a two-sided one-sample t-test at level α\alpha rejects H0:μ=μ0H_0: \mu = \mu_0 exactly when μ0\mu_0 lies outside the (1−α)(1 - \alpha) confidence interval xˉ±t∗sn\bar{x} \pm t^*\dfrac{s}{\sqrt{n}}.

H10. (Challenge) A random sample of 1010 lab reaction yields (in %) is:

4138444039434237406241 \quad 38 \quad 44 \quad 40 \quad 39 \quad 43 \quad 42 \quad 37 \quad 40 \quad 62

The target mean is 38%38\%, 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 1010 values, and again without 6262.
  • (c) The outlier made the sample mean bigger but the p-value larger. Explain why. What should the lab do about the value 6262?