Find the degrees of freedom for t-tests, Welch's test, chi-square tests, ANOVA and regression, with the formula worked through for your numbers.
df = number of values − number of estimates made from them
Degrees of freedom count how many values in a calculation are free to vary once you've fixed what you estimated from them.
Picture five numbers with a mean of 10. You can choose the first four freely, but the fifth is then forced so that the total is 50. Estimating the mean used up one degree of freedom, leaving four, which is why the sample variance divides by n − 1.
Degrees of freedom decide which t, chi-square or F distribution a test statistic is compared with. Get them wrong and the p-value is wrong too, especially with small samples.
As used throughout OpenStax Introductory Statistics and the NIST/SEMATECH e-Handbook. See Sources.
Using 12 (the number of cells) instead would compare the statistic with the wrong curve and make a real link much harder to detect.
A quick reference with an example for each.
| Test | df | Example |
|---|---|---|
| One-sample t | n − 1 | n = 15 → 14 |
| Paired t | pairs − 1 | 20 pairs → 19 |
| Two-sample t (pooled) | n₁ + n₂ − 2 | 12 and 15 → 25 |
| Chi-square independence | (r − 1)(c − 1) | 3 × 4 → 6 |
| Goodness of fit | k − 1 − p | 6 faces → 5 |
| One-way ANOVA | k − 1, N − k | 3 groups, 30 total → 2, 27 |
| Simple regression | n − 2 | 50 points → 48 |
They choose the exact shape of the t, chi-square or F distribution used for the p-value. Fewer df means fatter tails and stricter cut-offs.
Because deviations are measured from the sample mean, which was estimated from the same data. That uses one degree of freedom.
Yes. Welch’s t-test and some mixed models produce fractional df.
The t distribution approaches the normal distribution. Beyond about 100 df the difference is negligible.
F is a ratio of two variance estimates, each with its own df: between groups (k − 1) and within groups (N − k).
n − 2, because a straight line estimates two parameters, the slope and intercept.
The number of pairs. 20 people measured twice gives 19 df.
In regression, the observations left over after estimating the coefficients: n − p − 1. They’re used to estimate the error variance.
Related Tools