14
$\begingroup$

Note: $SST$ = Sum of Squares Total, $SSE$ = Sum of Squared Errors, and $SSR$ = Regression Sum of Squares. The equation in the title is often written as:

$$\sum_{i=1}^n (y_i-\bar y)^2=\sum_{i=1}^n (y_i-\hat y_i)^2+\sum_{i=1}^n (\hat y_i-\bar y)^2$$

Pretty straightforward question, but I am looking for an intuitive explanation. Intuitively, it seems to me like $SST\geq SSE+SSR$ would make more sense. For example, suppose point $x_i$ has corresponding y-value $y_i=5$ and $\hat y_i=3$, where $\hat y_i$ is the corresponding point on the regression line. Also assume that the mean y-value for the dataset is $\bar y=0$. Then for this particular point i, $SST=(5-0)^2=5^2=25$, while $SSE=(5-3)^2=2^2=4$ and $SSR=(3-0)^2=3^2=9$. Obviously, $9+4<25$. Wouldn't this result generalize to the entire dataset? I don't get it.

$\endgroup$
14
$\begingroup$

Adding and subtracting gives \begin{eqnarray*} \sum_{i=1}^n (y_i-\bar y)^2&=&\sum_{i=1}^n (y_i-\hat y_i+\hat y_i-\bar y)^2\\ &=&\sum_{i=1}^n (y_i-\hat y_i)^2+2\sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y)+\sum_{i=1}^n(\hat y_i-\bar y)^2 \end{eqnarray*} So we need to show that $\sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y)=0$. Write $$ \sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y)=\sum_{i=1}^n(y_i-\hat y_i)\hat y_i-\bar y\sum_{i=1}^n(y_i-\hat y_i) $$ So, (a) the residuals $e_i=y_i-\hat y_i$ need to be orthogonal to the fitted values, $\sum_{i=1}^n(y_i-\hat y_i)\hat y_i=0$, and (b) the sum of the fitted values needs to be equal to the sum of the dependent variable, $\sum_{i=1}^ny_i=\sum_{i=1}^n\hat y_i$.

Actually, I think (a) is easier to show in matrix notation for general multiple regression of which the single variable case is a special case: \begin{eqnarray*} e'X\hat\beta &=&(y-X\hat\beta)'X\hat\beta\\ &=&(y-X(X'X)^{-1}X'y)'X\hat\beta\\ &=&y'(X-X(X'X)^{-1}X'X)\hat\beta\\ &=&y'(X-X)\hat\beta=0 \end{eqnarray*} As for (b), the derivative of the OLS criterion function with respect to the constant (so you need one in the regression for this to be true!), aka the normal equation, is $$ \frac{\partial SSR}{\partial\hat\alpha}=-2\sum_i(y_i-\hat\alpha-\hat\beta x_i)=0,$$ which can be rearranged to $$ \sum_i y_i=n\hat\alpha+\hat\beta\sum_ix_i $$ The right hand side of this equation evidently also is $\sum_{i=1}^n\hat y_i$, as $\hat y_i=\hat\alpha+\hat\beta x_i$.

$\endgroup$
3
$\begingroup$

(1) Intuition for why $SST = SSR + SSE$

When we try to explain the total variation in Y ($SST$) with one explanatory variable, X, then there are exactly two sources of variability. First, there is the variability captured by X (Sum Square Regression), and second, there is the variability not captured by X (Sum Square Error). Hence, $SST = SSR + SSE$ (exact equality).

(2) Geometric intuition

Please see the first few pictures here (especially the third): https://sites.google.com/site/modernprogramevaluation/variance-and-bias

Some of the total variation in the data (distance from datapoint to $\bar{Y}$) is captured by the regression line (the distance from the regression line to $\bar{Y}$) and error (distance from the point to the regression line). There's not room left for $SST$ to be greater than $SSE + SSR$.

(3) The problem with your illustration

You can't look at SSE and SSR in a pointwise fashion. For a particular point, the residual may be large, so that there is more error than explanatory power from X. However, for other points, the residual will be small, so that the regression line explains a lot of the variability. They will balance out and ultimately $SST = SSR + SSE$. Of course this is not rigorous, but you can find proofs like the above.

Also notice that regression will not be defined for one point: $b_1 = \frac{\sum(X_i -\bar{X})(Y_i-\bar{Y}) }{\sum (X_i -\bar{X})^2}$, and you can see that the denominator will be zero, making estimation undefined.

Hope this helps.

--Ryan M.

$\endgroup$
1
$\begingroup$

When an intercept is included in linear regression(sum of residuals is zero), $SST=SSE+SSR$.

prove $$ \begin{eqnarray*} SST&=&\sum_{i=1}^n (y_i-\bar y)^2\\&=&\sum_{i=1}^n (y_i-\hat y_i+\hat y_i-\bar y)^2\\&=&\sum_{i=1}^n (y_i-\hat y_i)^2+2\sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y)+\sum_{i=1}^n(\hat y_i-\bar y)^2\\&=&SSE+SSR+2\sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y) \end{eqnarray*} $$ Just need to prove last part is equal to 0: $$\begin{eqnarray*} \sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y)&=&\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)(\beta_0+\beta_1x_i-\bar y)\\&=&(\beta_0-\bar y)\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)+\beta_1\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)x_i \end{eqnarray*} $$ In Least squares regression, the sum of the squares of the errors is minimized. $$ SSE=\displaystyle\sum\limits_{i=1}^n \left(e_i \right)^2= \sum_{i=1}^n\left(y_i - \hat{y_i} \right)^2= \sum_{i=1}^n\left(y_i -\beta_0- \beta_1x_i\right)^2 $$ Take the partial derivative of SSE with respect to $\beta_0$ and setting it to zero. $$ \frac{\partial{SSE}}{\partial{\beta_0}} = \sum_{i=1}^n 2\left(y_i - \beta_0 - \beta_1x_i\right)^1 = 0 $$ So $$ \sum_{i=1}^n \left(y_i - \beta_0 - \beta_1x_i\right)^1 = 0 $$ Take the partial derivative of SSE with respect to $\beta_1$ and setting it to zero. $$ \frac{\partial{SSE}}{\partial{\beta_1}} = \sum_{i=1}^n 2\left(y_i - \beta_0 - \beta_1x_i\right)^1 x_i = 0 $$ So $$ \sum_{i=1}^n \left(y_i - \beta_0 - \beta_1x_i\right)^1 x_i = 0 $$ Hence, $$ \sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y)=(\beta_0-\bar y)\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)+\beta_1\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)x_i=0 $$ $$SST=SSE+SSR+2\sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y)=SSE+SSR$$

$\endgroup$
0
$\begingroup$

This is just the Pythagorean theorem!enter image description here

$\endgroup$

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.