What Are Degrees of Freedom?
Degrees of freedom (df) represent the number of independent values that can vary in a statistical calculation. Think of it as the number of values that are “free to change” after you’ve applied constraints (like knowing the mean).
Why do they matter? The shape of test distributions (t, χ², F) depends on df. Using the wrong df gives you the wrong critical value and the wrong conclusion.
Quick Reference: df for Every Test
| Statistical Test | Degrees of Freedom Formula | Example |
|---|---|---|
| One-sample t-test | df = n − 1 | n = 25 → df = 24 |
| Paired t-test | df = n − 1 (n = number of pairs) | 15 pairs → df = 14 |
| Two-sample t-test (pooled) | df = n₁ + n₂ − 2 | 20 + 25 → df = 43 |
| Welch’s t-test | Complex formula (see below) | Use software |
| Chi-square goodness-of-fit | df = k − 1 | 5 categories → df = 4 |
| Chi-square independence | df = (r − 1)(c − 1) | 3×4 table → df = 6 |
| One-way ANOVA (between) | df₁ = k − 1 | 4 groups → df₁ = 3 |
| One-way ANOVA (within) | df₂ = N − k | 40 total, 4 groups → df₂ = 36 |
| Simple linear regression | df = n − 2 | n = 30 → df = 28 |
| Multiple regression | df = n − p − 1 | n = 50, 3 predictors → df = 46 |
| F-test (regression) | df₁ = p, df₂ = n − p − 1 | 3 predictors, n = 50 → df₁ = 3, df₂ = 46 |
Degrees of Freedom for T-Tests
One-Sample T-Test
Example: You survey 30 students about study hours. df = 30 − 1 = 29. Look up df = 29 in the t-table.
Paired T-Test
Example: You measure 20 patients before and after treatment. You have 20 pairs, so df = 20 − 1 = 19.
Two-Sample T-Test (Pooled / Equal Variances)
Example: Group A has 15 participants, Group B has 18. df = 15 + 18 − 2 = 31.
Welch’s T-Test (Unequal Variances)
This is complex — use our T-Test Calculator to compute it automatically.
Degrees of Freedom for Chi-Square Tests
Goodness-of-Fit Test
where k = number of categories.
| Categories | df |
|---|---|
| 2 (e.g., yes/no) | 1 |
| 3 | 2 |
| 4 | 3 |
| 5 | 4 |
| 6 | 5 |
Example: Testing if a die is fair (6 categories). df = 6 − 1 = 5. Look up in the chi-square table.
Test of Independence / Homogeneity
where r = rows, c = columns.
| Table Size | df |
|---|---|
| 2×2 | 1 |
| 2×3 | 2 |
| 2×4 | 3 |
| 3×3 | 4 |
| 3×4 | 6 |
| 4×4 | 9 |
| 4×5 | 12 |
| 5×5 | 16 |
Example: A 3×4 contingency table. df = (3 − 1)(4 − 1) = 2 × 3 = 6.
Degrees of Freedom for ANOVA
One-Way ANOVA
| Source | df Formula | Example (4 groups, N = 40) |
|---|---|---|
| Between groups | df₁ = k − 1 | 4 − 1 = 3 |
| Within groups | df₂ = N − k | 40 − 4 = 36 |
| Total | df_total = N − 1 | 40 − 1 = 39 |
Check: df_between + df_within = df_total → 3 + 36 = 39 ✓
Look up F-critical with df₁ and df₂ in the F-table.
Two-Way ANOVA
| Source | df |
|---|---|
| Factor A | a − 1 |
| Factor B | b − 1 |
| Interaction (A×B) | (a − 1)(b − 1) |
| Within (Error) | N − ab |
| Total | N − 1 |
Degrees of Freedom for Regression
Simple Linear Regression (1 predictor)
| Source | df |
|---|---|
| Regression | 1 |
| Residual | n − 2 |
| Total | n − 1 |
Multiple Regression (p predictors)
| Source | df |
|---|---|
| Regression | p |
| Residual | n − p − 1 |
| Total | n − 1 |
Example: Predicting exam score from 3 variables (study hours, sleep, attendance) with n = 50 students.
- Regression df = 3
- Residual df = 50 − 3 − 1 = 46
- F-test: use df₁ = 3, df₂ = 46 in the F-table
Worked Example: Choosing the Right df
Problem: You want to test whether male and female students prefer different types of music (Rock, Pop, Classical, Jazz). You survey 200 students.
- Test type: Chi-square test of independence (two categorical variables)
- Table size: 2 rows (gender) × 4 columns (music type)
- df = (2 − 1)(4 − 1) = 3
- Critical value at α = 0.05: Look up df = 3 in the chi-square table → 7.815
- If your calculated χ² > 7.815, gender and music preference are significantly associated.
Common Mistakes with Degrees of Freedom
- Using n instead of n − 1 for one-sample t-tests
- Confusing one-way and two-way ANOVA df — two-way requires interaction terms
- Forgetting to subtract 1 in chi-square goodness-of-fit
- Using the wrong df for Welch’s t-test — it’s not simply n₁ + n₂ − 2
- Counting total N instead of pairs for paired t-tests
Frequently Asked Questions
Why do we subtract 1 from the sample size?
When calculating from a sample, knowing the mean constrains one value. If you know the mean of 5 numbers and 4 of them, the 5th is determined. So only n − 1 values are “free” — hence df = n − 1.
What happens as degrees of freedom increase?
The t-distribution approaches the normal (z) distribution. With df > 30, t-values are very close to z-values. At df = ∞, they are identical.
Can degrees of freedom be a decimal?
Yes! Welch’s t-test often gives non-integer df (e.g., 23.7). Statistical software uses the exact value; for table lookups, round down to be conservative.
What if my df isn’t in the table?
Use the next smaller df value listed in the table for a conservative result, or use statistical software for the exact p-value. Our interactive tables accept any df value.
Related Resources
- t-Table - Critical t-values by df
- Chi-Square Table - Critical χ² values by df
- F-Table - Critical F-values by df₁ and df₂
- T-Test Calculator - Automatic df calculation
- Hypothesis Testing Guide - Full walkthrough