Degrees of freedom (df) is the number of values in a calculation that are free to vary once the constraints of the calculation — usually estimates already pulled from the same data, like a sample mean — are fixed. It is not a footnote to a statistical test; it is what determines which reference distribution (which exact shape of the t, chi-square, or F curve) a test statistic is compared against. Get df wrong, or fail to notice it doesn’t match the reported sample size, and the p-value that follows is wrong too.
Not to be confused with: researcher degrees of freedom, a completely different concept from research integrity — the flexibility a researcher has in analytic choices (which variables to include, which exclusions to apply, which test to run) that, left undisclosed, enables p-hacking. This page is about the statistical quantity used to select a reference distribution. See also questionable research practices for the integrity concept.
The core idea: what’s actually “free to vary”
Suppose you have three numbers and you’re told their mean is 10. You can pick the first two numbers to be anything you like — say, 4 and 15 — but the third number is no longer free: it must be 11, because the three numbers have to average to 10. Two of the three values were free to vary; the third was determined by the constraint. That data set has 2 degrees of freedom.
Generalize this: with n data points and one constraint (the mean is fixed), n − 1 values are free to vary. Every df formula in this guide is a version of the same bookkeeping — count the independent pieces of information, subtract however many parameters had to be estimated from the data before you could compute the statistic.
Why n − 1 for the sample variance: Bessel’s correction
The population variance formula divides the sum of squared deviations by n. But when you compute a sample variance, you don’t have the true population mean μ to measure deviations from — you have to estimate it first, using the sample mean x̄. That estimation step uses up one degree of freedom: once x̄ is fixed, only n − 1 of the n deviations from x̄ are free to vary (the last one is forced, exactly as in the three-number example above).
Because the sample mean is, by construction, the value that minimizes the sum of squared deviations within that specific sample, deviations measured from x̄ are systematically a little smaller than deviations measured from the true μ would be. Dividing by n instead of n − 1 therefore produces a variance estimate that is biased low on average. Dividing by n − 1 — Bessel’s correction — corrects that bias, giving an unbiased estimator of the population variance. This single n − 1 is the seed that every df formula below builds on.
Degrees of freedom in the common tests
Each test’s df formula follows the same logic: start with the number of independent observations, subtract one for each parameter estimated from the data along the way.
One-sample t-test: df = n − 1
One parameter (the population mean) is estimated from the sample to compute the test statistic, so one degree of freedom is spent. See the full walkthrough in the t-test guide.
Independent-samples t-test: df = n₁ + n₂ − 2
Two independent samples means two means are estimated (one per group) before the pooled variance can be computed, so two degrees of freedom are spent across the combined n₁ + n₂ observations. This formula assumes the two groups have roughly equal variances (the pooled-variance, “Student’s” t-test).
Welch’s t-test: an approximate, usually fractional df
When the two groups’ variances can’t be assumed equal, Welch’s t-test is used instead of the pooled-variance version, and its df is estimated from both groups’ variances and sample sizes via the Welch–Satterthwaite equation. The result is very rarely a whole number — software might report df = 27.4, and that’s correct output, not a rounding artifact (see “fractional df,” below). Welch’s test is now widely recommended as the safer default over the pooled-variance t-test specifically because it doesn’t assume equal variances.
Paired t-test: df = n − 1
A paired test first collapses each pair into a single difference score, so it’s really a one-sample t-test run on the n difference scores — same logic, same df.
One-way ANOVA: dfbetween = k − 1, dfwithin = N − k
With k groups and N total observations, comparing k group means to the grand mean uses up k − 1 degrees of freedom between groups (the k group means aren’t all free to vary once the grand mean is fixed), while N − k degrees of freedom remain within groups (each group loses one df to its own group mean). The two add up to N − 1, the total df for the full data set. The F-statistic’s reference distribution is indexed by both numbers together, written F(dfbetween, dfwithin).
Chi-square goodness-of-fit: df = k − 1
With k categories, once the expected total (matching the observed total) is fixed, only k − 1 category counts are free to vary — the last is forced by the total. See the worked examples in the chi-square test guide.
Chi-square test of independence: df = (r − 1)(c − 1)
In an r-row by c-column contingency table, the row and column totals (the marginals) are held fixed. Once the first (r − 1) row and (c − 1) column cells are chosen, every remaining cell is determined by the marginals — hence (r − 1)(c − 1) free cells.
Regression: model df = p, residual df = n − p − 1
For a regression with p predictors plus an intercept, p + 1 parameters are estimated from the n observations, leaving n − p − 1 residual degrees of freedom — the denominator in the mean squared error and the basis for the standard errors on every coefficient. See regression analysis for how those standard errors and coefficient tests are built on top of this.
What df does to the shape of the distribution
The t-distribution is shaped by df: at low df it has noticeably heavier tails than the normal distribution, reflecting the extra uncertainty in estimating variance from a small sample. As df increases, the t-distribution converges toward the standard normal distribution — by roughly df = 30 the two are close enough that some older textbooks used the normal distribution as a shortcut once sample size passed that threshold.
The practical consequence: at low df, the critical value you must clear for significance is larger than at high df, because the reference distribution has more probability mass out in the tails. A t-statistic of 2.0 might be non-significant at df = 5 (critical value around 2.57 at α = .05, two-tailed) but comfortably significant at df = 50 (critical value around 2.01). Low df is a direct, mechanical source of low statistical power — not because the effect is smaller, but because the bar for “surprising enough to matter” is higher when so little independent information underlies the estimate. The same logic applies to chi-square and F distributions, which are also indexed by df and change shape accordingly.
Reading df in reported results — and why it’s a useful integrity check
Statistical results are conventionally reported with the test statistic, its df, and the p-value, e.g. t(24) = 2.31, p = .03 or χ²(2, N = 150) = 8.4, p = .015. The number in parentheses is the df, and it should always be mechanically reconcilable with the stated sample size using the formulas above. For t(24) from an independent-samples t-test, the total sample should be 26 (df = n₁+n₂−2); for a one-sample or paired t-test, 25.
This makes df a genuinely useful, low-effort sanity check when reading a results section: if the reported df doesn’t reconcile with the stated n — too low, too high, or simply absent from a table — that’s a real signal of a possible reporting error, an undisclosed exclusion of participants or observations, or an unreported change in the analysis. It won’t catch every problem, but a mismatch is cheap to spot and worth asking about, whether you’re reviewing a manuscript, checking a collaborator’s output, or auditing your own analysis before submission. See what is a p-value for the broader context of how these reported statistics combine into a significance claim, and researcher degrees of freedom for the related but distinct integrity concept of undisclosed analytic flexibility.
Fractional df: not a mistake
Whole-number df comes from the simple counting logic above — but several widely-used procedures produce a df that isn’t an integer, and that is correct, not an error to round away:
- Welch’s t-test (above) estimates df from both groups’ sample variances and sizes; the result is a real number, e.g. df = 31.7.
- Mixed-effects (multilevel) models routinely report fractional df for fixed-effect tests, for reasons covered next.
Statistical software reports these values to one or two decimal places deliberately; truncating or rounding them to the nearest integer changes the reference distribution slightly and is unnecessary — use the value as reported.
Degrees of freedom in mixed-effects models
In a mixed-effects (multilevel/hierarchical) model, there is no single clean formula for the df of a fixed-effect test, because observations are correlated within clusters (e.g. repeated measurements within the same participant) rather than fully independent, and the model estimates both fixed effects and variance components for the random effects simultaneously. Unlike the closed-form n − 1-style formulas above, an appropriate df has to be approximated, and different approximation methods can give somewhat different results and p-values from the same model. The two most widely used approximations are:
- Satterthwaite approximation — generally faster to compute, standard in several major statistical packages’ mixed-model output.
- Kenward–Roger approximation — adjusts both the df and the standard errors, and tends to perform better with smaller samples or more complex random-effects structures, at higher computational cost.
This is a genuinely active area of methodological choice rather than a settled default, which is part of why df values from a mixed model are always fractional and why two analysts running the same data through the same model type can, correctly, get slightly different reported df depending on which approximation their software uses.
Frequently asked questions
Why isn’t df just the sample size?
Because computing most statistics requires first estimating one or more parameters (a mean, a set of group means, a set of regression coefficients) from that same sample. Each parameter estimated “uses up” one degree of freedom, leaving fewer independent pieces of information than the raw sample size would suggest.
Can degrees of freedom be negative or zero?
Not meaningfully for a valid analysis. df = 0 means there is no information left to estimate variability at all (e.g. a one-sample t-test on a single observation), and most software will refuse to compute a test statistic in that situation.
Does a higher df always mean a more trustworthy result?
Higher df generally means more precise estimates and more power to detect a real effect at a given significance threshold, all else equal. It says nothing on its own about whether the study was well designed, the sample was representative, or the effect is practically meaningful — df is a property of the statistical test, not a measure of study quality.
Is researcher degrees of freedom the same thing as statistical degrees of freedom?
No — they share a name and nothing else. Statistical df (this page) is a mechanical property of a calculation. Researcher degrees of freedom is a research-integrity concept describing the undisclosed analytic choices (which exclusions, which variables, which model) available to a researcher before a result is reported — the term was coined by Simmons, Nelson, and Simonsohn (2011) to explain elevated false-positive rates from otherwise “valid” analyses.







