# Why does the mean have $n-1$ degrees of freedom? [duplicate]

When calculating the standard deviation of a set of measurements of $X$, you use the formula $$\sqrt{\frac{1}{n-1}\sum_{i=1}^n(x_i-\bar x)^2}$$ A common explanation I have found for the $n-1$ factor is that it refers to the degrees of freedom. As I understand he degrees of freedom is the number of values you can pick, which is equal to the number of samples minus the number of relations between them.

Let's say $n=3$ and we pick values until our vector is fully determined. $$(x_1,x_2,x_3,\bar x)\\(4,x_2,x_3,\bar x)\\(4,9,x_3,\bar x)\\(4,9,x_3,7)$$ At this point we have enough information to calculate that $x_3=8$. We could also have picked $x_3$ to calculate $\bar x$. So why isn't the degrees of freedom $n$ since we had to pick $n$ values to fully determine the standard deviation?

• Your example is wrong, you cannot pick a value of the mean $\bar{x}$, as you said number of degrees is equal to sample size minus relations which in this case is $n - 1$ – Łukasz Grad Jan 31 '17 at 17:06
• @Tim that answer is actually pretty helpful but seems to be more about justifying the $n-1$ factor than about degrees of freedom. – AccidentalTaylorExpansion Jan 31 '17 at 17:14
• It follows from Cochran's theorem en.wikipedia.org/wiki/Cochran%27s_theorem – Łukasz Grad Jan 31 '17 at 17:17
• It isn't the mean that has "degrees of freedom": it's the estimate of the standard deviation. This issue is covered extensively in a large number of related posts. – whuber Jan 31 '17 at 17:38