The book Introduction to Statistical Learning by Gareth James et. al. states that a simple linear regression can be modeled as $\hat{y}_i=\hat{\beta}_0 + \hat{\beta_1}x_i$. The residuals are calculated $e_i=y_i-\hat{y}_i$.

They then go on to define the residual sum of squares as:

$$ RSS=e_1^2+e_2^2\dots e_n^2 $$

or equivalently as

$$ RSS=(y_1 - \hat{\beta}_0 - \hat{\beta_1}x_1)^2 + (y_2 - \hat{\beta}_0 - \hat{\beta_1}x_2)^2 +\dots+(y_n - \hat{\beta}_0 - \hat{\beta_1}x_n)^2 $$

My question is if $\hat{y}_i=\hat{\beta}_0 + \hat{\beta_1}x_i$, then why when they substitute into the RSS equation above do I see that it is equal to $\hat{y}_i=\hat{\beta}_0 - \hat{\beta_1}x_i$? Does it not matter because it is being squared? It just seems like for clarity you would substitute it exactly as you just previously defined it. I do not see anything in the errata. Is this a typo or does it just not matter?


As you said, the residuals are defined by :

$e_i = y_i - \hat{y}_i = y_i - ( \hat{\beta}_0 + \hat{\beta_1}x_i ) = y_i - \hat{\beta}_0 - \hat{\beta_1}x_i$

  • $\begingroup$ Oh my gosh, duh. Sorry, I'm not thinking straight. Thanks for setting me right! Complete lapse in thought haha $\endgroup$ – Dylan Russell Oct 5 '18 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.