# Sum of Square decomposition

Question about the Total, Explained, and Residual Sum of Squares. I am in the simple linear regression model.

Could you help me clarify why the residual sum of squares (SSE where E stands for errors)

$$SSE = \sum_{i=1}^n (\hat{Y}_{i}-Y_{i})^{2}$$

is the amount in variance of Y which is not explained by the model and why the explained sum of squares (SSR where R stands for regression)

$$SSR = \sum_{i=1}^n (\hat{Y}_{i}-\bar{Y})^{2}$$

is the amount in variance of Y which is explained by the model, where $Y_{i}$ are the observations, $\bar{y}$ is the esperance and $\hat{Y}_{i}$ are the predicted values in the model.

• These are estimated amounts, not genuine variances. – Xi'an Dec 31 '14 at 13:59
• this was clear to me. how does comparing estimated values to the mean does account for model whereas comparing estimated values to the observations does account for the amount not explained by the model ? – kiriloff Dec 31 '14 at 14:13
• Deviation from the mean is called total variation. Squared sum of total variation is $$TSS=\sum_{i=1}^{n}(Y_i-\bar{Y})^2.$$If you decompose $Y_i$ in two parts as $Y=\hat{Y}+\hat{\varepsilon}$, $\hat{Y}$ is the part explained by the model, and $\hat{\varepsilon}$ is the unexplained counterpart.Total variation is then,$$TSS=\sum_{i=1}^{n}(\hat{Y}+\hat{\varepsilon}-\bar{Y})^2$$Since $\hat{\varepsilon} = Y-\hat{Y}$, sum of the squared total variation can be decomposed into $$TSS=SSR+SSE.$$So, technically, SSR is the amount in the TSS explained by the model. – Khashaa Dec 31 '14 at 14:48
• This is also a statistical version of Pythagoras' theorem. – Xi'an Dec 31 '14 at 14:58

If you take a normal regression model, $$Y_i|X_i\sim\mathcal{N}(X_i^\text{T}\beta,\sigma^2),$$ the density of the data $(Y_1,\ldots,Y_n)$ writes as follows: \begin{align*}&\exp\left\{ -\frac{1}{2\sigma^2}\sum_{i=1}^n (Y_i-X_i^\text{T}\beta)^2 \right\}\\ &\qquad=\exp\left\{-\frac{1}{2\sigma^2}\sum_{i=1}^n [(Y_i-X_i^\text{T}\hat{\beta})^2 +(X_i^\text{T}\hat{\beta}-X_i^\text{T}\beta)^2]\right\}\\ &\qquad=\exp\left\{-\frac{1}{2\sigma^2}[\text{SSR}+\text{SSE}]\right\}\\ &\qquad=\exp\left\{-\frac{1}{2\sigma^2}\text{SSE}\right\}\times\exp\left\{-\frac{1}{2\sigma^2}\text{SSR}\right\}\end{align*} and only the first term depends on the parameter $\beta$ and hence characterises the model fit, while the second term is about the residual variability of the $Y_i$'s around their best prediction or projection, $X_i^\text{T}\hat{\beta}$.