
Image by Editor
Do you like wearing hats? Suppose you own seven different ones, and have the resolution to wear a distinct hat every day of the week. It’s Monday, and you have seven options to choose from. Tomorrow, Tuesday, you’ll have six choices. But what happens eventually when Sunday comes? You have no choices left: just wear the remaining hat.
That Sunday situation is what we call a lost Degree of Freedom (df) in statistics. The degree of freedom is defined as the number of independent values in a dataset that you can freely vary when estimating parameters or testing hypotheses. As soon as you estimate a parameter, like the mean, you “spend” or lose a degree of freedom.
Three very particular things occur to your downstream calculation when your data loses its “freedom”. Let’s uncover them:
Degrees of Freedom forcing “Safety Margins” onto your Spread
Imagine you are measuring the heights of a group of five people to work out the variation among human heights. To calculate the spread, you may feel tempted to divide the total variation by 5. However, with metrics like standard deviation and variance, you are told to divide by 4, i.e. $n-1$. This gives you a larger result, so why would this be more desirable? Because a small group’s spread will, in most cases, be smaller than that in the whole global population. Shrinking the denominator in various spread measures acts as a forced safety margin to remind us that there’s (almost) definitely more variation in the real world than in the small group we considered.
Degrees of Freedom Stretching the Tail of Probability Curves
When a t-test or other standard statistical test is run, the degree of freedom dictates what the exact shape of the probability curve will be. With 100 degrees of freedom (assuming once again the simplest form of degrees of freedom as $n-1$), we have a tall, skinny bell; in other words, extreme or rare events are remarkably unlikely. Meanwhile, if we dropped the degrees of freedom down to 4, the peak of the curve flattens out, with the tails on both sides getting thicker. Put another way, low freedom forces the mathematical assumption that extreme or unexpected events are more likely to occur.
Degrees of Freedom Preventing Playing “Connect the Dots”
Suppose you are plotting 20 dots on a graph and try to draw a “tendency line” to display the overall direction the dots are moving. A simple straight line uses only 2 degrees of freedom — in mathematics, the slope $m$ and anchor $b$ of the line function. Most likely, you won’t be able to reach every dot, but you might be able to properly demonstrate the big picture of how dots are moving.

But what if you drew a wild, 19-bend rollercoaster curve to successfully touch all points? You would have spent $n-1 = 19$ degrees of freedom, and the result might look perfect on your existing points. But as soon as you add a 21st dot (new data), your rollercoaster will likely miss it completely: this is a very common problem in machine learning, called overfitting, which happens when playing “connect-the-dots” too aggressively.
