Understand the idea
Imagine you know that four numbers must average to 10. You can pick the first three freely (say 8, 11, 15), but the fourth is now forced (it must be 6, so the four average to 10). Three of the four values were 'free'; the fourth was determined. That is the idea behind degrees of freedom: one is used up for every quantity you estimate from the data before computing the statistic.
For a single sample's variance or standard deviation, you lose one degree of freedom because you had to estimate the mean first before you could measure how spread out the data are around it, so n observations give n - 1 degrees of freedom.
Degrees of freedom show up because they set the exact SHAPE of the reference distribution (t, chi-square, F) that a p-value is read from. Fewer degrees of freedom (a smaller or more heavily modeled sample) means a wider, fatter-tailed reference distribution and a more cautious test; more degrees of freedom moves the reference distribution closer to the normal or a tighter chi-square/F shape.
Degrees of freedom are usually written df in output tables. In regression, the residual degrees of freedom are the number of rows minus the number of estimated coefficients, counting the intercept. The Welch t-test uses the Satterthwaite approximation, which gives degrees of freedom that are often not whole numbers, such as 187.3.
Practitioner explanation
Formally, df is the rank of the space in which the residual vector is free to vary: for a linear model with n observations and p estimated parameters (including the intercept), the residual has n - p degrees of freedom, because p linear constraints (the normal equations) pin down that many dimensions of the residual space.
Different procedures compute df differently and getting this wrong is a common source of silently incorrect output: pooled two-sample t uses n1 + n2 - 2; Welch's t uses the Satterthwaite approximation (generally non-integer); a chi-square test of independence on an r x c table uses (r-1)(c-1); ANOVA partitions total df among between-groups, within-groups (error) and total. Reporting an integer df for a Welch test, or the wrong contingency-table formula, is a detectable and common transcription error.
KernelStats computes and reports the exact df for each procedure's actual formula (Satterthwaite for Welch's t, n1+n2-2 for the pooled option, (r-1)(c-1) for chi-square, df_resid = n - p for OLS), and the reporting templates print it to the appropriate precision (an integer for Student's t and chi-square, one or two decimals for Welch's t) so the exported write-up matches the test that was actually run.
When to use it
Consider it when
Whenever you read off a critical value or a p-value from a t, chi-square, or F table: df determines which curve applies.
Use caution when
Do not assume df is always n - 1 or always an integer; the correct formula depends on the specific test, and Welch's t and mixed models routinely produce fractional degrees of freedom.
Formulas and symbols
Degrees of freedom, pooled two-sample t
Two parameters (the two group means) are estimated before the pooled variance is computed.
Common misconceptions
Misconception
More degrees of freedom always means a more significant result.
Correction
Degrees of freedom shape the reference distribution, they do not by themselves make a result more or less significant. A larger df narrows the reference distribution's tails, but the p-value still depends jointly on the test statistic and df together.
References
- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.6.4 t distribution, NIST/SEMATECH (2012), §1.3.6.6.4.
