# Thread: SSE simple linear regression

1. ## SSE simple linear regression

I am given SSE= $\sum_{i=1}^n(y_i-\hat{y}_i)^2$ and am asked to show that it $=\sum_{i=1}^n(y_i-\bar{y})^2-\hat{\beta}_1\sum_{i=1}^n(x_i-\bar{x})(y_i-\bar{y})$

where $\hat{y}_i=\hat{\beta}_0+\hat{\beta}_1x_i$ and $\hat{\beta}_0=\bar{y}-\hat{\beta}_1\bar{x}$

So here's what I got:

$\sum_{i=1}^n(y_i-\hat{y}_i)^2$

$=\sum_{i=1}^n(y_i-\hat{\beta}_0-\hat{\beta}_1x_i)^2$

$=\sum_{i=1}^n(y_i-\bar{y}+\hat{\beta}_1\bar{x}-\hat{\beta}_1x_i)^2$

$=\sum_{i=1}^n(y_i-\bar{y}-\hat{\beta}_1(x_i-\bar{x}))^2$

$=\sum_{i=1}^n[(y_i-\bar{y})^2-2\hat{\beta}_1(y_i-\bar{y})(x_i-\bar{x})+\hat{\beta}_1^2(x_i-\bar{x})^2]$

$=\sum_{i=1}^n(y_i-\bar{y})^2-2\hat{\beta}_1\sum_{i=1}^n(y_i-\bar{y})(x_i-\bar{x})+\hat{\beta}_1^2\sum_{i=1}^n(x_i-\bar{x})^2$

and i've got nothing from here.... anyone? thanks

2. You are just one step short. For simplicity convert everything into sums of squares notation, with

$S_{xx} = \sum (x_i - \bar{x})^2, S_{xy} = \sum (x_i - \bar{x})(y_i - \bar{y})$ and note that $\hat{\beta_1} = \frac{S_{xy}}{S_{xx}}$ (which I'm assuming you can take as given).

3. Originally Posted by theodds
You are just one step short. For simplicity convert everything into sums of squares notation, with

$S_{xx} = \sum (x_i - \bar{x})^2, S_{xy} = \sum (x_i - \bar{x})(y_i - \bar{y})$ and note that $\hat{\beta_1} = \frac{S_{xy}}{S_{xx}}$ (which I'm assuming you can take as given).
$=\sum_{i=1}^n(y_i-\bar{y})^2-2\hat{\beta}_1\sum_{i=1}^n(y_i-\bar{y})(x_i-\bar{x})+\hat{\beta}_1^2\sum_{i=1}^n(x_i-\bar{x})^2$

$=S_{yy}-2\hat{\beta}_1S_{xy}+\hat{\beta}_1\frac{S_{xy}}{S_ {xx}}\cdot S_{xx}$

$=S_{yy}-\hat{\beta}_1S_{xy}$

Good call