# 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?

## marked as duplicate by whuber♦ regression StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Dec 31 '18 at 18:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• 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 at 8:36

## 1 Answer

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