Why is $SST=SSE + SSR$? (One variable linear regression) 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.
 A: (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.
A: 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$$
A: 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$.
A: Here is a great graphical representation of why SST = SSR + SSE.

A: This is just the Pythagorean theorem!
                                        
Hence,
$$Y'Y=(Y-X\hat{\beta})'(Y-X\hat{\beta})+(X\hat{\beta})'X\hat{\beta}$$
or
$$SST=SSE+SSR$$
A: If a model predicts $3$ and the residual is $2$ because the actual value is $5$, it doesn't look like variance is decomposing, since $3^2 + 2^2 \neq 5^2$.
If you only have one data point, your model would fit it perfectly and the residual would be zero, so you can't get that case by itself. There have to be multiple data points.
With multiple data points, the residuals won't all be positive.
If the model predicts 3, a residual of $+2$ and $-2$ should be equally likely. The balance of increases and decreases gives a nice cancellation:
$$\frac{(3+2)^2 + (3-2)^2}{2} = \frac{25+1}{2} = 13 = 9 + 4 = 3^2 + 2^2 $$
This property, that $(a+b)^2 + (a-b)^2 = 2(a^2 + b^2)$, is what makes variance decomposition work, for uncorrelated components.
