# Residual Sum of Squares degrees of freedom intuition [duplicate]

Let RSS = Residual sum of squares $$= \sum (y_i - \hat{y}_i)^2$$. Without proof, $$\frac{RSS}{\sigma^2} \sim \chi^2_{n-2}$$. I do not quite understand why the DoF is $$n-2.$$ Could someone explain?

• stats.stackexchange.com/questions/258461/… contains relevant discussion. – Christoph Hanck Dec 31 '18 at 17:31
• Are we to assume that $\hat{y}_i=\hat{\beta}_0+\hat{\beta}_1X_1 + e_i$? Only if you have a model where you have to estimate two parameters (i.e. $\beta_0$ and $\beta_1$) will you have $n-2$ degrees of freedom. – StatsStudent Dec 31 '18 at 17:47
• @Christoph I believe your reference might be a little misleading. This is purely a question about the distribution of $RSS;$ there is no statistic in evidence that has an $F$ ratio distribution. – whuber Dec 31 '18 at 18:39
• This search uncovers several answers: stats.stackexchange.com/…. – whuber Dec 31 '18 at 18:44
• @whuber, the reference was just one that quickly came to my mind as I had worked on it - the others surely are closer to the point of the question. – Christoph Hanck Jan 2 '19 at 8:36

The "intuition" is that to estimate the RSS you need to first estimate the means for each point $$\hat y_i$$, there goes one DoF. Then to do inference, you're estimating the ratio $$RSS/\sigma^2$$, where the variance also has to be estimated, usually, so it takes away another DoF.
Actually, in the regression you have $$\hat y_i=X_i\hat\beta$$, so if you have $$k$$ bona fide variables the DoF is really $$n-k-2$$
• I think this answer misses the mark. The estimation of the means of the conditional responses already requires two parameters: an intercept and slope. In the question, $\sigma^2$ does not refer to an estimate, for otherwise the correct distribution to use would be an $F$ ratio distribution rather than the $\chi^2.$ – whuber Dec 31 '18 at 18:37