Explain the concept of 'degrees of freedom' in statistical testing.
Instruction: Define 'degrees of freedom' and describe its importance in the context of statistical hypothesis testing.
Updated
Official answer
Degrees of freedom describe the independent information remaining after constraints or fitted quantities are accounted for in a particular statistic. They are not always simply the sample size minus one.
For a sample variance around an estimated mean, the deviations sum to zero. Once n−1 deviations are known, the last is determined, giving n−1 degrees of freedom. With five observations, that is four.
For a full-rank ordinary linear regression with n observations and p estimated coefficients including the intercept, residual degrees of freedom are n−p. Thus 20 observations and three coefficients give 17. If the design is rank deficient, use its rank rather than merely counting columns.
The appropriate degrees of freedom help specify a reference distribution for tests or intervals when the model assumptions hold. Welch's unequal-variance t procedure uses an approximate degrees-of-freedom calculation that need not be an integer. Correct degrees of freedom do not guarantee significance or validate the study design.