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
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
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}