Step during regression coefficient calculation

43 Views Asked by At

I'm having some problems with a step given in my textbook when it comes to calculating one of the regression coefficient for simple regression.

I'm wondering about the following step: $$n\sum_{i=1}^{n}x_i^2 - \bigg(\sum_{i=1}^{n}x_i\bigg)^2 = \sum_{i=1}^{n}(x_i - \bar{x})^2$$

What are the steps in between? I have tried searching for similar topics here, but only found one considering $\frac{1}{n}$ in front instead of $n$.

1

There are 1 best solutions below

0
On BEST ANSWER

Remember that

$$ \overline{x} = \frac{1}{n}\sum_{i=1}^n x_i $$

and note that

\begin{eqnarray} \sum_{i=1}^n (x_i - \overline{x})^2 &=& \sum_{i=1}^n (x_i^2 -2 x_i\overline{x} + \overline{x}^2) \\ &=& \sum_{i=1}^n x_i^2 - 2 \overline{x}\sum_{i=1}^n x_i - n\overline{x}^2 \\ &=& \sum_{i=1}^n x_i^2 - 2 \overline{x}\underbrace{\sum_{i=1}^n x_i}_{n\overline{x}} - n\overline{x}^2 \\ &=& \sum_{i=1}^n x_i^2 - 2 n\overline{x}^2 - n\overline{x}^2 \\ &=& \sum_{i=1}^n x_i^2 - n\overline{x}^2 \\ &=& \sum_{i=1}^n x_i^2 - n\left(\frac{1}{n}\sum_{i=1}^n x_i\right)^2 \\ &=& \sum_{i=1}^n x_i^2 - \frac{1}{n}\left(\sum_{i=1}^n x_i\right)^2 \end{eqnarray}

Perhaps a typo in your source?