# Error sum of square for OLS estimator

The error sum of squares is defined as:

$$SSe(\beta)=(y-X\beta)'(y-X\beta)\tag{1}$$

I want to show that for the OLS estimator $$\hat\beta$$,

$$SSe(\beta)=SSres+(\beta-\hat\beta)'X'X(\beta-\hat\beta)\tag{2}$$

I know that $$SSres=SSe(\hat\beta)$$, but I don't understand how to reach equation $$(2)$$ from $$(1)$$.

• Can you check your question? In line 2, you end up with $(\beta-\beta)$ twice, which is identically zero. I think I se what you want to do, but can you clarify? – eSurfsnake Jun 1 '19 at 23:05
• It looks right to me, should be (beta - beta hat) – Oscar Jonsson Jun 3 '19 at 9:07
• – StubbornAtom Jun 20 '19 at 15:37

You can rewrite $$y$$ as $$y=X\hat{\beta}+\epsilon$$. Note that, here $$\hat{\beta}$$ represents estimated parameters and $$\epsilon$$ is the residual term.
Then, Eq. (1) becomes: $$\begin{equation} SSE(\beta)=(X\hat{\beta}+\epsilon-X\beta)^T(X\hat{\beta}+\epsilon-X\beta)\\ =(X(\hat{\beta}-\beta)+\epsilon)^T (X(\hat{\beta}-\beta)+\epsilon)\\ =((\hat{\beta}-\beta)^TX^T+\epsilon^T)(X(\hat{\beta}-\beta)+\epsilon)\\ =(\hat{\beta}-\beta)^TX^TX(\hat{\beta}-\beta)+\epsilon^T\epsilon\\ =(\hat{\beta}-\beta)^TX^TX(\hat{\beta}-\beta)+SSE(\hat{\beta}) \end{equation}$$