Degrees of freedom = observations minus estimated parameters
Every parameter you estimate from the data (a mean, a group mean, a regression coefficient) removes one value that is free to vary. That is why a one-sample t-test with 25 observations has 24 degrees of freedom: 24 numbers can be anything, but the 25th is pinned down once the mean is fixed.
The formula for each test
| Test | Inputs | Degrees of freedom |
|---|---|---|
| One-sample t | n | n − 1 |
| Two-sample t | n₁, n₂ | n₁ + n₂ − 2 |
| Chi-square (r×c table) | rows r, columns c | (r − 1)(c − 1) |
| ANOVA, between groups | k groups | k − 1 |
| ANOVA, within groups | k groups, N total | N − k |
| Linear regression | n samples, p predictors | n − p − 1 |
A 3×4 chi-square table has (3−1)(4−1) = 6 df. Four ANOVA groups over 80 observations give F(3, 76). Regression subtracts one extra for the intercept.
What the number changes downstream
- It sets the critical value. A two-tailed t-test at α = 0.05 needs ±2.228 at df = 10, but only ±2.042 at df = 30, and ±1.960 as df approaches infinity (the normal distribution).
- It shapes the distribution. Fewer degrees of freedom give the t-distribution thicker tails and less certainty; more df pull it toward normal.
- It narrows confidence intervals. Larger samples mean higher df, a smaller t-multiplier, and a tighter interval for the same data spread.
Common questions
What are degrees of freedom in simple terms?
They are the number of values in a calculation that are free to vary. If five numbers must average to a fixed value, you can pick four freely but the fifth is forced, so you have four degrees of freedom. Estimating a parameter like the mean costs you one.
Why is degrees of freedom usually n minus 1?
Because a one-sample test estimates one thing from the data, the sample mean, and that uses up one degree of freedom. So from n observations you are left with n minus 1 that can vary independently.
Can degrees of freedom be zero or negative?
No. Zero or negative degrees of freedom means you have more constraints than data, which usually signals too many predictors for the sample size. The value must be a positive whole number.
How do degrees of freedom affect the p-value?
They set the shape of the test distribution. The same test statistic gives a larger p-value with fewer degrees of freedom and a smaller one with more, because larger samples produce tighter distributions and lower critical values.


