The t-test, explained with examples
A t-test checks whether a mean, or a difference between means, is significantly different from a claimed value. It is the workhorse test for quantitative data in AP Statistics and in real research.
On this page
Why t instead of z?
To test a claim about a population mean μ, we compare the sample mean x̄ with the claimed value. If we knew the population standard deviation σ, we could use a z statistic. In practice σ is almost never known, so we estimate it with the sample standard deviation s. That extra uncertainty is handled by the t distribution, which looks like the normal curve but has heavier tails, especially for small samples. As the sample size grows, the t distribution gets closer to the normal distribution.
The t statistic
t = (x̄ − μ0) / (s / √n), with df = n − 1 degrees of freedom.
The denominator s/√n is the standard error of the mean. The t statistic tells you how many standard errors the sample mean is from the claimed value. Large values of |t| give evidence against H0.
Conditions
- Random: a random sample or a randomised experiment.
- 10% condition: when sampling without replacement, n is at most 10% of the population.
- Normal/large sample: the population is approximately normal, or n ≥ 30. For small samples, check a dotplot or boxplot of the data for strong skewness or outliers.
The four steps
Every AP significance test follows the same structure: State the hypotheses and significance level with the parameter defined in context; Plan by naming the test and checking conditions; Do the calculation of t, df and the P-value; and Conclude by comparing the P-value with α and answering in context.
Worked examples
Example 1: a one-sample t-test
A company claims its batteries last 40 hours on average. A random sample of 16 batteries has mean 38.2 hours and standard deviation 3.0 hours. Is there evidence at α = 0.05 that the mean is less than 40 hours?
- State: H0: μ = 40; Ha: μ < 40, where μ is the true mean life of all the company's batteries.
- Plan: one-sample t-test. Random sample; 16 is less than 10% of all batteries; n is small, so we need the sample data to show no strong skewness or outliers.
- Do: t = (38.2 − 40)/(3.0/√16) = −1.8/0.75 = −2.4, df = 15. P-value = P(t15 ≤ −2.4) ≈ 0.015.
- Conclude: 0.015 < 0.05, so reject H0. There is convincing evidence that the true mean battery life is less than 40 hours.
Example 2: a paired t-test
Eight students took a test before and after a revision course. The mean of the differences (after − before) was 4.5 points, with standard deviation 5.2. Test whether the course improves scores, at α = 0.05.
- The same students were measured twice, so the data are paired. Work with the differences as one sample.
- H0: μdiff = 0; Ha: μdiff > 0.
- t = 4.5/(5.2/√8) ≈ 4.5/1.838 ≈ 2.45, df = 7. P-value ≈ 0.022.
- 0.022 < 0.05, so reject H0: there is convincing evidence that the course increases scores on average for students like these. Without random selection of students, be careful generalising to everyone.
Example 3: a two-sample t-test
Random samples of commuters: by train, n = 25, mean 42 minutes, s = 8; by car, n = 30, mean 48 minutes, s = 10. Is there a difference in mean commute times? Use α = 0.05.
- H0: μtrain − μcar = 0; Ha: μtrain − μcar ≠ 0.
- Standard error = √(8²/25 + 10²/30) = √(2.56 + 3.333) ≈ 2.428. t = (42 − 48)/2.428 ≈ −2.47.
- Using technology, df ≈ 53 and the two-sided P-value ≈ 0.017.
- 0.017 < 0.05, so reject H0: there is convincing evidence that the mean commute times differ, with train commuters taking less time on average.
Paired or two-sample?
This choice is a favourite AP question. Use a paired test when each observation in one group is naturally matched with one in the other: the same people before and after, twins, or left and right hands of the same person. Use a two-sample test when the groups are independent, such as two separate random samples. Using a two-sample test on paired data throws away the matching and usually makes it harder to detect a real effect.
When the result is not significant
If the P-value is larger than α, write: “Because the P-value is greater than α, we fail to reject H0. There is not convincing evidence that …”. This does not prove the claim is true. A small sample may simply be unable to detect a real but modest difference, which is a Type II error risk.
Degrees of freedom
For one-sample and paired tests, df = n − 1. For a two-sample test, the exact df comes from a complicated formula that calculators handle automatically. A conservative approach, if you are working by hand, is to use the smaller of n1 − 1 and n2 − 1. Fewer degrees of freedom give a slightly larger P-value, so the conservative choice is safe.
Using a calculator
On a TI-84, T-Test handles one-sample and paired data (enter the differences as one list), and 2-SampTTest handles independent samples; choose “Pooled: No” for AP Statistics. On the exam, always write the test name, t, df and P-value, not just the calculator's output.
Common mistakes
- Using z when σ is unknown; use t with s.
- Treating paired data as two independent samples.
- Writing hypotheses about x̄ instead of the population mean μ.
- Skipping the normality check for small samples.
- Concluding “accept H0” or stating a conclusion without context.
Practice questions
Try each one before opening the answer.
Q1. x̄ = 52, μ0 = 50, s = 6, n = 36. Find t.
Show answer
Q2. Twenty patients have blood pressure measured before and after a drug. Which test?
Show answer
Q3. Two random samples of 40 bulbs from different factories are compared. Which test?
Show answer
Q4. As n increases, what happens to the t distribution?
Show answer
Frequently asked questions
Is the t-test on the AP Statistics exam?
Yes. Inference for means, including one-sample, paired and two-sample t procedures, is Unit 7 and appears on almost every free-response section.
Is the t-test in A level Maths?
No. A level Maths hypothesis testing uses the binomial and normal distributions. The t-test is in some Further Maths options and is used widely at university.
Key takeaways
- Use t when σ is unknown: t = (x̄ − μ0)/(s/√n).
- One-sample and paired tests use df = n − 1.
- Paired data: analyse the differences as one sample.
- Check random, 10% and normal/large-sample conditions.
- State, Plan, Do, Conclude, always in context.