# degree of freedom, when to $-1$ or $-2$? [duplicate]

I have taken an introductory course in statistics. But I cant understand the degree of freedom. I understand that it is the number of dimensions of free components of the final random variable. But I couldn't get why it is sometimes $n-1$ or $n-2$ rather than simply $n$?(where $n$ is the number of observations in the experiment)

Can someone kindly explain to me in simple language or redirect me to a straightforward material, why/when is the degree of freedom not $n$?

## 1 Answer

this is a bizarre question, and in my opinion, a bad question. Sorry, but this is way too vague to have a meaningful answer. I only answered this because it is a bit too long to be a comment.

The correct degree of freedom is whatever it is, because the statistic you calculate is given by that distribution with that degree of freedom. the non-rigorous rule of thumb tells you that you lose 1 degree of freedom everytime you estimate a parameter. That is why you use $X^2_{n-1}$, for example, if you test a variance with unknown mean. However, this should only serve an intuition.

The actual derivation is often too long and rarely studied (not where I am from anyway. probably because it is just some algebra, and people who studies statistics for purpose of application does not find it interesting)