Carrying Out a Test for a Mean
How to compute the t test statistic and its p-value for a population mean or mean difference, interpret the p-value, and write a conclusion in context.
Measure how far the sample mean is from the null value in standard errors: \(t = (\bar{x} - \mu_0)/(s/\sqrt{n})\). If H₀ is true, this statistic follows a t-distribution with \(n - 1\) degrees of freedom, and the p-value is the area beyond it in the direction of Hₐ. For matched pairs, use the mean and standard deviation of the differences, with \(\mu_0 = 0\).
1The test statistic
The numerator is how far the sample mean is from the null value; the denominator is the standard error. When the null hypothesis is true, the t-statistic has a t-distribution with \(n - 1\) degrees of freedom. For a mean difference, \(\bar{x}\) is \(\bar{x}_d\), \(s\) is \(s_d\), \(n\) is the number of pairs, and \(\mu_0 = 0\).
2The p-value
The p-value is found from the t-distribution with df = \(n - 1\), using a table or technology. It is the probability of a test statistic as extreme as or more extreme than the observed one, in the direction of the alternative, assuming H₀ is true.
| Alternative | p-value |
|---|---|
| \(H_a: \mu \lt \mu_0\) | \(P(t \le t_{\text{obs}})\), the left tail |
| \(H_a: \mu \gt \mu_0\) | \(P(t \ge t_{\text{obs}})\), the right tail |
| \(H_a: \mu \ne \mu_0\) | \(2P(t \ge |t_{\text{obs}}|)\), both tails |
Phone batteries
Interpret the p-value of 0.0223.
- 1Begin with the assumption that H₀ is true, in context: the mean is 10 hours.
- 2Then the observed result in the direction of Hₐ, and the sample size.
“Assuming that the true mean battery life is 10 hours, there is a 0.0223 probability of getting a sample mean of 9.85 hours or less in a random sample of 20 phones.”
With \(s\) in place of \(\sigma\), the statistic follows a t-distribution. The normal curve gives \(P(Z \le -2.15) = 0.0158\), smaller than the correct 0.0223, and makes the evidence look stronger than it is.
3The decision and the conclusion
Compare the p-value with α: if the p-value ≤ α, reject H₀; if the p-value \(\gt\) α, fail to reject H₀. Then state the conclusion in context, in terms of Hₐ, using non-definitive language and naming the parameter and the population.
Phone batteries
A random sample of 20 phones from a shipment of 2,000 had a mean battery life of 9.85 hours with standard deviation 0.312 hours under the maker’s standard test. The maker advertises 10 hours. Is there convincing evidence at \(\alpha = 0.05\) that the true mean is less than 10 hours?
- 1State. \(H_0: \mu = 10\), \(H_a: \mu \lt 10\), where \(\mu\) = the true mean battery life (hours) of all phones in the shipment. \(\alpha = 0.05\).
- 2Plan. One-sample t-test for a population mean. Random sample; 20 ≤ 200; \(n \lt 30\) but the dotplot of the data shows no strong skewness or outliers.
- 3Do. \(SE = 0.312/\sqrt{20} \approx 0.0698\). \(t = \dfrac{9.85 - 10}{0.0698} \approx -2.15\), df = 19. p-value \(= P(t \le -2.15) \approx 0.0223\).
- 4Conclude. Because the p-value of 0.0223 is less than \(\alpha = 0.05\), we reject \(H_0\). There is convincing evidence that the true mean battery life of the phones in the shipment is less than 10 hours.
Data in L1: STAT, TESTS, T-Test, Inpt: Data, μ₀: 10, List: L1, choose μ < μ₀, Calculate. Output: t = −2.1498, p = 0.0223, \(\bar{x}\) = 9.85, Sx = 0.312. For matched pairs, store the differences in a list (for example L3 = L1 − L2) and run T-Test on L3 with μ₀ = 0.
The batteries average about 9 minutes less than advertised. The test shows the shortfall is unlikely to be chance; whether 9 minutes matters is a separate, practical question. An interval answers it better by showing how big the difference plausibly is.
4A matched pairs test and a two-sided test
Notifications and reaction time
Thirty students took a reaction-time test with notifications on and off, in random order. The differences (on − off) had mean 14.2 ms and standard deviation 28.5 ms. Test \(H_0: \mu_d = 0\) against \(H_a: \mu_d \gt 0\) at \(\alpha = 0.05\).
- 1Conditions: random order of the two conditions; 30 differences, so the sample data condition is met (\(n \ge 30\)).
- 2\(SE = 28.5/\sqrt{30} \approx 5.20\). \(t = (14.2 - 0)/5.20 \approx 2.73\), df = 29.
- 3p-value \(= P(t \ge 2.73) \approx 0.0053\).
Cereal boxes
Boxes are labeled 400 g. A random sample of 25 boxes had \(\bar{x} = 401.1\) g and \(s = 3.2\) g, with no strong skewness or outliers. Is there convincing evidence at \(\alpha = 0.05\) that the true mean differs from 400 g?
- 1\(H_0: \mu = 400\), \(H_a: \mu \ne 400\).
- 2\(SE = 3.2/\sqrt{25} = 0.64\). \(t = (401.1 - 400)/0.64 \approx 1.72\), df = 24.
- 3Two-sided: p-value \(= 2P(t \ge 1.72) \approx 2(0.0493) = 0.0985\).
For \(H_a: \mu \ne 400\), the one-tail area 0.0493 is only half the story. Reporting 0.0493 would wrongly suggest rejecting H₀ at α = 0.05; the correct p-value is 0.0985.
Failing to reject H₀ means the data are consistent with 400 g, not that the mean is 400. Write “there is not convincing evidence that the true mean differs from 400 g.”
Quick reference
| Step | What to write |
|---|---|
| Test statistic | \(t = (\bar{x} - \mu_0)/(s/\sqrt{n})\), df = \(n - 1\) (pairs: \(\bar{x}_d\), \(s_d\), \(\mu_0 = 0\)) |
| p-value | t-distribution tail(s) in the direction of Hₐ |
| Interpretation | Assuming [H₀ in context], there is a [p] probability of getting a sample mean of [x̄] or [more/less] in a random sample of [n]. |
| Decision | p-value ≤ α: reject H₀; p-value \(\gt\) α: fail to reject H₀ |
| Conclusion | There is (not) convincing evidence that [Hₐ in context]. |
| Calculator | T-Test |