What the one-sample t-test does
The one-sample t-test checks whether a sample mean differs from a reference value μ₀: a specification, a historical average or a theoretical value. With the same calculation, the paired t-test compares two measurements on the same subjects (before and after, left and right) by testing whether the mean of the differences is zero.
The formula
t = (x̄ − μ₀) ÷ (s ÷ √n), with n − 1 degrees of freedom
where x̄ is the sample mean, s the sample standard deviation and n the sample size. The quantity s ÷ √n is the standard error of the mean.
Example
A filling machine should deliver 100 g. A sample of 25 packs has a mean of 103 g and an SD of 12 g:
- standard error: 12 ÷ 5 = 2.4 g;
- t = 3 ÷ 2.4 = 1.25 with 24 degrees of freedom;
- two-tailed p ≈ 0.22: not significant at α = 0.05;
- 95% confidence interval of the mean: 103 ± 2.064 × 2.4, about 98.0 to 108.0 g, which includes 100.
Paired data
For paired measurements, compute the difference for each pair (after − before), then enter:
- the mean of the differences as the sample mean;
- the SD of the differences as the standard deviation;
- the number of pairs as n;
- 0 as the reference value.
Pairing removes the variation between subjects, which often makes the test far more sensitive than comparing two independent groups.
Reading the result
- p below α: the mean differs significantly from the reference value.
- p at or above α: the data are compatible with the reference value, which is not the same as proving it.
- The confidence interval gives the range of plausible true means; when it excludes μ₀, the two-tailed test is significant at the same α.
Effect size
Cohen’s d = (x̄ − μ₀) ÷ s expresses the difference in standard deviations. Around 0.2 is often called small, 0.5 medium and 0.8 large. With large samples, tiny differences become significant, so always look at the size of the effect too.
Assumptions
The observations should be independent and roughly normally distributed, or the sample large enough (often 30 or more). Outliers can distort both the mean and the SD: check the data before testing. For clearly non-normal small samples, the Wilcoxon signed-rank test is an alternative.