Bell Statistics

What are degrees of freedom?

Degrees of freedom count how many values in a calculation are free to vary once the quantities estimated from the data are fixed. They determine which reference curve a test statistic is judged against, and they shrink every time something is estimated.

Notation
df
Also called
df, degrees of freedom in statistics
Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

In plain English

Take five numbers with a mean of 10. Four of them can be anything at all; once they are chosen the fifth is forced, because the mean has to come out at 10. Four values are free to vary and one is not, so there are four degrees of freedom. That is the whole concept, and every formula below is a version of it: start with how many observations you have, subtract one for each quantity you estimated from those same observations along the way.

It matters because it selects the curve your test statistic is compared against. The t-distribution is a family, not a single shape, and degrees of freedom picks the member — few degrees of freedom give heavy tails and a demanding critical value, many give something indistinguishable from the normal curve. A t statistic of 2.3 is significant at 30 df and not at 4 df, and nothing about the data changed between those two readings except how much of it there was.

The subtraction is not bookkeeping pedantry; it is what stops a variance estimate from being biased. Dividing the sum of squared deviations by n rather than n − 1 systematically underestimates the spread, because the deviations are measured from the sample's own mean, which sits closer to the data than the true mean does. Dividing by the degrees of freedom instead of the count corrects that, which is why variance is defined with n − 1 in the denominator and why the correction matters most when n is small.

Different designs count differently and the arithmetic is worth knowing. A one-sample t-test has n − 1. A pooled two-sample t-test has n₁ + n₂ − 2, one subtracted for each mean estimated. A chi-square test on an r × c table has (r − 1)(c − 1), because once the row and column totals are fixed most of the cells are determined — a 2 × 2 table has just one free cell, which is why it has one degree of freedom. A one-way ANOVA splits its degrees of freedom into k − 1 between groups and N − k within them, and the F ratio is built from both.

The odd case is Welch's t-test, which returns a fraction — 8,040.3 rather than a whole number. That is not a rounding error. Welch's does not assume the two groups share a variance, so its effective degrees of freedom are computed from how the two variances and sample sizes combine, and the result has no reason to be an integer. Seeing a fractional df in output is confirmation that the correct default test was used rather than the pooled one.

The formula

One rule, applied to each design: the number of independent observations, minus one for every parameter estimated from those same observations.

One-sample t-test
df = n − 1

One mean was estimated from the data, so one value is no longer free.

Pooled two-sample t-test
df = n₁ + n₂ − 2

Two group means estimated, so two subtracted — see the two-sample t-test calculator.

Chi-square on a contingency table
df = ( rows − 1 ) · ( columns − 1 )

A 2 × 2 table gives 1; a 2 × 3 gives 2. Fixing the margins determines the rest — see the chi-square calculator.

One-way ANOVA
df_between = k − 1, df_within = N − k

k groups, N observations in total. The F statistic is a ratio of two variances carrying these two counts.

Welch–Satterthwaite
df ≈ ( s₁²/n₁ + s₂²/n₂ )² / ( (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) )

Fractional by design. A non-integer df in your output means Welch's test ran, which is the correct default.

Worked example

The same t statistic of 2.30 is produced by three studies of different sizes: a pilot with 5 users per arm, a mid-sized test with 16 per arm, and a full experiment with 500 per arm. All three used the pooled two-sample test. The question is which of them can call the result significant at the conventional 5% level.

Test statistic (all three)
t = 2.30
Pilot
n = 5 + 5, df = 8, critical value 2.306
Mid-sized
n = 16 + 16, df = 30, critical value 2.042
Full experiment
n = 500 + 500, df = 998, critical value 1.962
Normal-curve critical value
1.960

The pilot misses at p = 0.0503. The mid-sized test clears at p = 0.0286. The full experiment clears at p = 0.0217.

Identical evidence, three different verdicts, and the only thing that varied was how much was estimated along the way. The pilot's near-miss is the instructive one: at 8 degrees of freedom the bar is 2.306 and the statistic is 2.30, so it fails by four thousandths — which is a good illustration of why treating 0.05 as a boundary between proof and failure is indefensible. Note also how fast the penalty disappears. Between 30 df and 998 df the critical value moves from 2.042 to 1.962, a difference of 4%, and beyond a few hundred observations degrees of freedom stop being something anyone needs to think about. They earn their attention in small studies, which is exactly where people are most tempted to reach for 1.96.

Common misconceptions

Degrees of freedom are just the sample size.
They are the sample size minus the number of quantities estimated from that same sample. The gap is negligible at n = 1,000 and decisive at n = 6, which is where the concept earns its keep. Treating the two as interchangeable means using a critical value that is too lenient, on exactly the small studies least able to afford it.
A fractional degrees-of-freedom value in the output means something is broken.
It means Welch's t-test ran rather than the pooled Student's version, which is the correct default for online experiments. Welch's computes an effective degrees of freedom from how the two variances and sample sizes combine, and that quantity has no reason to be a whole number. A fraction is reassurance, not an error.
More degrees of freedom make it easier to find a significant result.
They lower the critical value, so in that narrow sense yes — but only because the extra data genuinely justifies a less cautious threshold. Degrees of freedom are a consequence of how much information you collected, not a lever. The effect also flattens quickly: nearly all of the benefit is captured by about 30, and past a few hundred there is essentially none left to gain.

Frequently asked questions

Why is it n minus 1 rather than n for degrees of freedom?
Because the sample mean was calculated from the same data, and once it is fixed the final observation is determined by the others. Dividing by n instead would systematically underestimate the spread, since deviations measured from the sample's own mean are smaller on average than deviations from the true mean. The n − 1 correction removes that bias, and it matters most when n is small.
How many degrees of freedom does a contingency table have?
Rows minus one, multiplied by columns minus one. A 2 × 2 table has one, because once the row and column totals are known a single cell determines all four. A 2 × 3 table has two, and a 4 × 5 has twelve. The count matters because chi-square critical values grow with it, so a large table needs a substantially bigger statistic to reach the same p-value.
Do degrees of freedom matter in a large online experiment?
Barely. Beyond roughly 200 the t critical value is within a fraction of a percent of the normal curve's 1.96, and no shipping decision would turn on the difference. They matter in small studies — customer interviews, enterprise pilots, early-stage tests with a handful of accounts — where the correction can be 10% or more and ignoring it produces confidence intervals that are too narrow.

Related terms

  • One-tailed vs two-tailed test

    The choice that halves your p-value and costs you the ability to see damage — and why it must be made before the data arrives.

  • T-distribution

    The bell curve's cautious cousin — and the reason a small sample needs a bigger result to clear the same bar.

  • T-test

    The workhorse for comparing two averages — and the four assumptions that decide whether its answer means anything.

  • Variance

    Spread in squared units — awkward to read, and the quantity every sample-size formula is built on.

  • Z-test

    The test behind every conversion-rate readout — and the one condition that decides whether it is safe to use.

Calculate it

  • Two-sample t-test

    Compare the average of two independent groups — plan the sample size, then test the result.

  • Chi-square test

    Test a contingency table of counts for association — any number of rows and columns.

Knowing the term is the easy part

Applying it to a live measurement problem is the part that goes wrong. If you are designing an experiment, reading a result you do not trust, or trying to work out what your marketing actually caused, that is the work we do.