How is this formula equivelnt in simple linear regression (short question)

41 Views Asked by At

How does my teacher go from

$$Sxx= \sum x_{i}^{2}-n(\hat x)^2$$ to

$$=\sum (x_{i}-\hat x)^{2}$$

I know all the definitions and I tried writing it out but I cannot get the same result. can anyone please help

1

There are 1 best solutions below

0
On BEST ANSWER

You probably meant $\bar{X}$, thus \begin{align} \sum(X_i - \bar{X})^2 &= \sum(X_i^2 - 2X_i\bar{X}+\bar{X}^2)=\sum X_i^2 -2\bar{X}\sum X_i+n\bar{X}^2\\ &=\sum X_i^2 -2\bar{X}n\bar{X}+n\bar{X}^2=\sum X_i^2-n\bar{X}^2. \end{align}