The one-sample t-test checks whether a sample mean differs from a specific value: a target, a claim on a label, or a published population average. Enter raw data or the mean, SD and sample size, choose the hypothesized mean μ₀, and get t, df, p, a confidence interval and Cohen’s d.
Hypotheses
H₀: μ = μ₀ (the population mean equals the hypothesized value). H₁: μ ≠ μ₀ for a two-tailed test, or μ > μ₀ / μ < μ₀ for a one-tailed test chosen in advance.
t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1
Assumptions
- Observations are independent of each other.
- The data are roughly normally distributed. With 30 or more observations the test is robust to moderate skew.
- For skewed small samples, compare the median with μ₀ using the one-sample Wilcoxon test.
Worked example
A supplier claims its parts weigh 15 g on average. Ten parts weigh 12, 15, 11, 18, 21, 13, 16, 14, 19 and 22 g. The sample mean is 16.1 g with SD 3.78 g, so t(9) = 0.92 and p = .382. There is not enough evidence that the true mean differs from 15 g. The 95% confidence interval for the mean, 13.4 to 18.8 g, is wide, so a larger sample would be needed to settle the question.
Frequently asked questions
When should I use a z-test instead?
Only when the population standard deviation is genuinely known in advance, which is rare. With an SD estimated from the sample, the t-test is correct. For large samples the two give nearly identical results.
What does the confidence interval add?
The p-value only says whether the mean differs from μ₀. The interval shows how big the difference could plausibly be, which is usually more useful for decisions.