I remember getting frustrated as an undergraduate trying to find straight answer to this question.
The standard text book answer is something like this:
"In statistics, the number of degrees of freedom is the number of values in the final calculation of a statistic that are free to vary"
That’s from Wikipedia but it’s fairly typical.
I could just about make sense of this for something like a chi-squared statistic but why, could someone explain to me, are the degrees of freedom for linear regression n-k-1?
I realise this doesn’t keep many people awake but it did me so I was pleased to find the following quote:
"The person who is unfamiliar with N-dimensional geometry or who knows the contributions to modern sampling theory only from secondhand sources such as textbooks, this concept often seems almost mystical, with no practical meaning." Walker, 1940
Many years later I’m nasty enough to use it as an interview question. In a kinder frame of mind I thought I’d post my slightly XKCD inspired notes for explaining, as simply as I can, the concept in terms of N-dimensional geometry.
I hope you can read my writing and apologies to mathematicians if the language is a bit loose!