# Simple linear regression parameter estimation

In the method of least square I have the following

$$\hat{B_1}=\frac{\sum (Y_i-\bar{Y})X_i} {\sum (X_i-\bar{X})X_i} \\ ~~~~= \frac{\sum (Y_i-\bar{Y})(X_i-\bar{X})} {\sum (X_i-\bar{X})^2} \\ ~~~~= \frac{S_{XY}}{S_{XX}}$$

So my question is about the derivation of the second equality. Could you please explain how you arrived at that step? Thank you.

• look up "regression through origin" Aug 13 at 21:40

\begin{align} \hat{B_1} &=\frac{\sum (Y_i-\bar{Y})X_i} {\sum (X_i-\bar{X})X_i} \\ &=\frac{\sum (Y_i-\bar{Y})(X_i-\bar{X}+\bar{X})} {\sum (X_i-\bar{X})(X_i-\bar{X}+\bar{X})} \\ &=\frac{\sum \left((Y_i-\bar{Y})(X_i-\bar{X})+(Y_i-\bar{Y})\bar{X}\right)} {\sum \left((X_i-\bar{X})(X_i-\bar{X})+(X_i-\bar{X})\bar{X}\right)} \\ &=\frac{\sum \left(Y_i-\bar{Y})(X_i-\bar{X}\right)+\color{red}{\sum(Y_i-\bar{Y})\bar{X}}} {\sum \left(X_i-\bar{X})(X_i-\bar{X}\right)+\color{red}{\sum(X_i-\bar{X})\bar{X}}} \\ &= \frac{\sum (Y_i-\bar{Y})(X_i-\bar{X})} {\sum (X_i-\bar{X})^2} \end{align}