Choose degrees of freedom for the model you actually fitted
Degrees of freedom index reference distributions and account for constraints or estimated parameters. They are not universally “sample size minus one.” Some approximations, including Welch’s t-test, give fractional degrees of freedom.
Reference formulas and conditions
| Procedure | Degrees of freedom | Important condition |
|---|---|---|
| One-sample t | n − 1 | n independent observations |
| Paired t | n − 1 | n complete independent pairs, not 2n measurements |
| Pooled two-sample t | n₁ + n₂ − 2 | Equal-variance model |
| Welch two-sample t | Satterthwaite approximation below | Use actual group variances and sizes |
| Chi-square goodness-of-fit | k − 1 − q | q appropriately estimated model parameters; regularity conditions |
| Chi-square independence | (r − 1)(c − 1) | Full ordinary table; structural zeros may change the model |
| One-way ANOVA between groups | k − 1 | k nonempty groups |
| One-way ANOVA residual | N − k | N total observations; ordinary independent equal-variance model |
| Pearson correlation t test | n − 2 | n independent matched pairs; correlation-test assumptions |
| Linear-model residual | n − rank(X) | X is the full design matrix, including any intercept |
| Full-rank regression with intercept | n − p − 1 | p predictor columns, not necessarily p named variables |
A three-level categorical predictor typically uses two columns. Interactions and transformed terms add columns. A rank-deficient model does not get valid residual df by simply counting variable names. Logistic regression tests do not automatically use the same t reference as ordinary linear regression.
Welch’s approximation
Let a = s₁²/n₁ and b = s₂²/n₂. Then:
For n₁ = 30, n₂ = 35, s₁ = 10 and s₂ = 12, ν ≈ 62.96. Software can use this fractional value directly. Rounding down in a t critical-value table can be conservative for that lookup; it is not a general rule for all reference distributions or all approximations.
Worked examples
Fifteen before/after pairs give paired-t df = 14, not 29. Four ANOVA groups with N = 40 give numerator df = 3 and denominator df = 36. The total df is 39, and 3 + 36 = 39.
A 3 × 4 ordinary contingency table gives (3 − 1)(4 − 1) = 6 df. A goodness-of-fit test with six fixed category probabilities gives 5 df; estimating parameters from those same observations can change it.
Use the correct reference
Read the t-table, chi-square table or F-table with the correct tail convention and parameters. The t-test calculator calculates df from your selected design.
NIST explains two-sample tests and the Welch approximation; its goodness-of-fit reference discusses estimated-parameter adjustments.