TITLE: What is degree of freedom in statistics?
QUESTION [27 upvotes]: In statistics, degree of  freedom is widely used in regression analysis, ANOVA and so on. But, what is degree of  freedom ?
Wikipedia said that 


The number of degrees of freedom is the number of values in the final  calculation of a statistic that are free to vary.
Mathematically, degrees of freedom is the number of dimension of the  domain of a random vector, or essentially the number of 'free' 
  components: how many components need to be known before the vector is
  fully determined.


However, it is still hard for me to understand the concept intuitively.
Question:
Could anyone provide a intuitive explain to the concept and anything can help me understand?
Thanks!

Update:
I'm NOT asking how to calculate degree of freedom.
Let me give an example:
For Chi-squared distribution, different degree of freedom produces different probability density function. Could you explain it intuitively?

REPLY [4 votes]: To understand the concept intuitively, ask the question of why it is needed. And start from a simpler question, why is the variance computed as $V = \frac 1 {N-1} \sum (x_i-\bar x)^2$ with a $N-1$ as denominator.
The fact is that you are interested in the variance of the population, not of the one of sample. Now obviously the sample is less dispersed than the population (because it is very likely that your sample missed a few of the extreme values), so the variance computed on the sample is lower than the variance of the population. 
You have to correct the bias.
Intuitively, the observed average $\bar x = \frac 1 N \sum x_i$ is not exact but only an approximation of the population mean. The variance of this approximation should be added to the observed variance on the sample in order to to get the best approximate of the population sample.
Now this variance can be computed: $\sigma^2(\bar X) = \frac 1 N \sigma^2(X)$ (using the iid if the $X_i$). So the sample variance is $1 -\frac 1 N$ the variance of the population. 
Formally (in case you need to read twice the previous reasoning), compute the expected value of $\sum (X_i-\bar X)^2$. You will find $(N-1) \sigma^2$ rather than $N \sigma^2$, hence the population variance is $\frac N {N-1}$ the sample variance (as claimed).
When you follow the computations, you start by replacing $\bar X$ by its definition $\bar X = \frac 1 N \sum X_i$, develop the squares, expand the sum, and then one of the term disappears. Namely $N\bar X=\sum X_i$ appears twice with opposite sign, negative in the double product $2 \bar X X$ and positive in the square $\bar X^2$. So $\sum (X_i-\bar X)^2$ is the sum of $N-1$ terms equal in expectation.
This is because the $X_i$ are not independent but linked by one relation $\sum X_i=N \bar X$. In general, if you know the $X_i$ are linked by $p$ independent linear relations $f_j$, then you can cancel out $p$ terms out of the sum $\sum (X_i-f_j(X_i))^2$. Hence the unbiased estimator, $\sum (X_i-f_j(X_i))^2 \approx \frac N {N-p} \sum (x_i-f_j(x_i))^2$.
In regression, ANOVA, etc, the independents relations are not so independent because it is often supposed that the sum of the independents variables (causes) have the same average than the dependent variable (effect). $\sum a_i \bar X_i = \bar Y$. Hence the degree of freedom $N-1$, $p-1$ and $N-p$ and unbiasing factors $\frac N {N-1}$, $\frac p {p-1}$ and $\frac N {N-p}$  for $SS_{Total}$, $SS_{Model}$ and $SS_{Error}$ respectively.
In two words, the degree of freedom is the number of independent relationships linking a set of variables, taking into account the variable introduced for intermediary estimators.