The formula, and what each piece does
A one-sample t-test asks whether your sample mean differs from a hypothesized value. The statistic is the gap between them, divided by the standard error — so t is the difference expressed in standard-error units. The bigger t is in size, the less likely the gap is chance.
- x̄ is the sample mean; μ is the value you are testing against.
- s is the sample standard deviation; n is the sample size.
- s ÷ √n is the standard error — how much the mean would wobble from sample to sample.
Degrees of freedom set how strict the test is
For one sample, df = n − 1. You pair t with its df to read a p-value from the t-distribution. Fewer degrees of freedom mean fatter tails and a higher bar to clear, so small samples need a larger t to reach significance.
| df (n−1) | Critical t (two-tailed, α=0.05) |
|---|---|
| 9 (n=10) | 2.262 |
| 19 (n=20) | 2.093 |
| 29 (n=30) | 2.045 |
| ∞ (large n) | 1.960 |
If your calculated |t| exceeds the critical value for your df, the result is significant at that level. As n grows, the threshold slides toward the z-test's 1.96.
What people read into t incorrectly
- A big t is not a big effect. t grows with sample size, so a tiny, unimportant difference can produce a large t and a small p-value. Report an effect size (Cohen's d = (x̄ − μ) ÷ s) alongside it.
- The p-value is not the chance the null is true. It is the chance of data this extreme if the null were true.
- Sign just shows direction. A negative t means your mean is below μ; the two-tailed test cares only about the magnitude.
Common questions
What does the t-statistic tell me?
It measures how far your sample mean sits from the value you are testing against, counted in standard errors. A t near zero means the sample agrees with that value; a large t (positive or negative) means it does not. You compare t against the t-distribution to get a p-value.
What are the degrees of freedom for a one-sample t-test?
They equal n minus 1, where n is the sample size. You lose one degree of freedom because the sample mean was estimated from the same data. With 20 observations, df is 19.
When should I use a t-test instead of a z-test?
Use a t-test when the population standard deviation is unknown or the sample is small, which covers most real cases. The z-test needs a known population standard deviation or a large sample. The t-distribution has fatter tails, so it is more cautious with little data.


