# Deriving Regression Sum of Squares (SSR)

In a simple linear regression

$SSR = \sum(\hat{y} - \bar{y})^2$

$SSXY = \sum(x - \bar{x})(y-\bar{y})$

$SSX = \sum(x - \bar{x})^2$

$SSR$ can be computed by dividing $SSXY^2$ by $SSX$. Namely, $SSR = SSXY^2/SSX$

Could someone illustrate mathematically how this is obtained? Thanks!!

From the answers at Is there a way to use the covariance matrix to find coefficients for multiple regression? we know the least squares equations for the estimated coefficient $\widehat\beta$ are

$$SS_X \widehat\beta = SS_{XY}$$

where the predicted values are given by

$$\widehat{y}_i=x_i\widehat{\beta}.$$

Squaring both sides and summing, recognizing that $\Sigma_i x_i^2=SS_X$, yields

$$SS_R=SS_X \widehat\beta^2.$$

Plugging in the solution $\widehat\beta^2 = \left(SS_{XY} / SS_X\right)^2$ from the first equation turns this into

$$SS_R=SS_X \left(SS_{XY} / SS_X\right)^2 =SS_{XY}^2/SS_X.$$

• I can follow the logic of your explanation, but after the step $\widehat{y}_i=x_i\widehat{\beta}.$, I can't seem to get things right. For example, when I square $\widehat{y}_i$, what I get is the sum of the square of each predicted value, not $\sum(\hat{y}-\bar{y})$. Could you explain a little as to what might be my mistake? (I was doing it in R, so I basically did y_hat %*% y_hat)
– Alex
Jul 30, 2014 at 0:19
• Without any loss of generality, you may assume that the means of the $x$ and $y$ are zero (center the variables).
– whuber
Jul 30, 2014 at 1:45