How it's calculated
df = n − 1 (one-sample case)
one-sample t: n−1; two-sample t: n₁+n₂−2; chi-square: (r−1)(c−1); ANOVA: between = k−1, within = N−k; regression residual: n−p−1. n = sample size, r/c = rows/columns, k = groups, p = predictors.
Worked examples
| Test | df formula | Example | df |
|---|---|---|---|
| One-sample t | n - 1 | n = 20 | 19 |
| Two-sample t (pooled) | n1 + n2 - 2 | n1 = 12, n2 = 15 | 25 |
| Chi-square independence | (r-1)(c-1) | 3x4 table | 6 |
| One-way ANOVA (between) | k - 1 | k = 4 groups | 3 |
Common questions
What are degrees of freedom?
They are the number of values in a calculation that are free to vary. For a one-sample t-test with n observations, df = n - 1 because the sample mean fixes one value.
Why does df matter for a t-test?
It selects the exact t-distribution used to find the critical value and p-value. Fewer degrees of freedom give a wider distribution and a higher critical value.