# $SSR = \sum(\hat y_t - \bar y)^2 = \sum\hat y_t^2 - n \bar y^2$

From Statistical Methods for Forecasting by Abraham and Ledolter:

Let $$\hat y = X \hat \beta$$, where $$\hat \beta$$ is the least squares estimate $$(X^TX)^{-1}X^Ty$$.

Then $$SSR = \sum(\hat y_t - \bar y)^2 = \sum\hat y_t^2 - n \bar y^2$$.

I'm having trouble showing this equality.

I see that expanding and eliminating expressions similar to both sides we're left with showing:

$$\sum(y_t - \hat y_t) = 0$$, but I can't figure this either.

Anyone have any ideas?

Let's decompose $$$$SSR = \sum\limits_{t=1}^n(\hat y_t - \bar y)^2 = \sum\limits_{t=1}^n \hat y_t^2 - 2\sum\limits_{t=1}^n\hat y_t \bar y + \sum\limits_{t=1}^n \bar y^2$$$$ Notice that $$\bar y$$ does not depend on the summation index $$t$$ and hence could be extracted outside the sum as $$$$SSR = \sum\limits_{t=1}^n \hat y_t^2 - 2\bar y\sum\limits_{t=1}^n\hat y_t + \bar y^2\sum \limits_{t=1}^n 1 = \sum\limits_{t=1}^n \hat y_t^2 - 2\bar y\sum\limits_{t=1}^n\hat y_t + n\bar y^2 \tag{1}$$$$ It is true that (As you say) if $$\sum(y_t - \hat y_t) = 0$$, then we get the desired result. Notice that this happens when $$X$$ is a square and invertible matrix, because $$$$\hat{\beta} = (X^TX)^{-1}X^Ty =X^{-1}X^{-T} X^{T}y = X^{-1}y$$$$ where $$X^{-T} = (X^{-1})^T$$. Now, you can write $$\hat{y}$$ as $$$$\hat{y} = X\hat{\beta} = XX^{-1}y = y$$$$ This means that $$\sum \hat{y}_t = \sum y = n\bar{y}$$. Replacing this in $$(1)$$, we get $$$$SSR = \sum\limits_{t=1}^n \hat y_t^2 - 2n\bar y^2+ n\bar y^2 = \sum\limits_{t=1}^n \hat y_t^2 - n\bar y^2$$$$