← Glossarydegrees of freedom (df)
The number of values free to vary once the estimated quantities are fixed, e.g. n - 1 for one sample, n1 + n2 - 2 for a two-sample t-test.
Learn it in the course
- Two-sample t-test · The two-sample t-test (Student's t-test): comparing the means of two groups and deciding whether the gap is bigger than chance.
- Repeated measures ANOVA · Tracking the same users across several points in time with a repeated measures ANOVA or the Friedman test.
- One-way ANOVA: comparing many groups · Testing three or more variants at once with a one-way ANOVA, without inflating false positives.
- Paired t-test: before and after · Comparing the same users before and after a change with a paired t-test or the Wilcoxon signed-rank test.
Degrees of freedom (df) count how many values in your calculation are genuinely free to vary once something has already been fixed by the data. The classic illustration: if you know that five numbers average 40, you can pick any four of them, but the fifth is then forced, because the total must be 200. Five values, one constraint, four degrees of freedom.
That is exactly why the sample variance divides by n−1 instead of n:
s2=n−1∑(xi−xˉ)2
The deviations are measured from the sample mean xˉ, which was itself computed from the same data, so they always sum to zero and only n−1 of them carry independent information. Dividing by n would systematically underestimate the spread, badly so in small samples.
Every test that estimates something from the data "spends" degrees of freedom, and the formula depends on the test:
Why it matters in practice: df pick which curve you compare your statistic against. With few df the t-distribution has fatter tails than the normal, so the critical value is larger and you need a stronger signal to reject H0. As df grow, the t-distribution approaches the normal and its two-tailed 5% critical value approaches 1.96. Software computes df for you; your job is to know that small df means a stricter bar.
Where the "minus one" comes from. CatChow's new pickup point logged orders over 5 days, averaging 40 a day, so the total is 200. Pick any four days: 38, 45, 36 and 42, which sum to 161. The fifth day is no longer free: 200−161=39. Five values, four degrees of freedom.
Now the variance of these five days. Deviations from the mean of 40: −2,5,−4,2,−1 (they sum to 0, as they always must). Squared: 4+25+16+4+1=50.
- Dividing by n−1=4: s2=12.5, so s≈3.54 orders.
- Dividing by n=5 would give 10, an underestimate of the true day-to-day spread.
In a t-test. The upsell-widget test compared 10 control orders with 10 variant orders, so df=10+10−2=18. The two-tailed critical value at α=0.05 is 2.101. With only 5 orders per group, df=8 and the bar rises to 2.306; with huge samples it falls to 1.96.
In a chi-square test. Marketing compares conversion across 3 ad channels, with 2 outcomes each (converted or not). The table is 3×2, so df=(3−1)(2−1)=2, and the 5% critical value of chi-square is 5.99.