Degrees of Freedom

Definition

The degrees of freedom refer to the number of independent observations in a set of data. From a single sample of size $n$, the number of independent values is $n-1$.

Why do we need degrees of freedom?

Consider the following data set

\[75, 79, 56, 81, 66, 58, 77, 61, 71, 76\]

The mean is \[\dfrac{75 + 79+ 56+ 81+ 66+ 58+ 77+ 61+ 71+ 76}{10}=70\]

To calculate the standard deviation, a little care is needed. The deviations of each number are as follows

\begin{align} 75-70 &= 5 \\ 79-70 &= 9\\ 56-70 &= -14 \\ 81-70 &=11 \\ 66-70 &= -4 \\ 58-70&= -12 \\ 77-70 &= 7 \\ 61-70 &= -9 \\ 71-70 &= 1 \\ 76-70 &= 6 \end{align}

But these are not independent, they have to add up to $0$ because of how the mean is calculated, i.e. the last deviation is dependent on the other $9$. So only $9$ out of the $10$ deviations are independent. In general, $n-1$ out of $n$ deviations will be independent hence we have $n-1$ degrees of freedom.