So I am learning how to use the method of least squares to find the best fit straight line and there is this one part in the derivation I do not fully understand and I was wondering if anyone could help me out.(adsbygoogle = window.adsbygoogle || []).push({});

So basically we start out with the residuals of the equation of a straight line..

[tex]y_i-mx_i-c[/tex]

And now we take the root mean square of these residuals and try to find the minimum points of m and c by taking the partial derivatives.

[tex]\Sigma (y_i-mx_i-c)^2[/tex]

[tex]\frac{\partial S}{\partial m}=-2\Sigma x_i(y_i-mx_i-c)=0[/tex]

[tex]\frac{\partial S}{\partial c}=-2\Sigma (y_i-mx_i-c)=0[/tex]

Now from the second equation it is easy to see that

[tex]c=\overline{y}-m\overline{x}[/tex]

since

[tex]\overline{y}=\frac{1}{n}\Sigma y_i[/tex]

and

[tex]\overline{x}=\frac{1}{n}\Sigma x_i[/tex]

Solving the first equation for m we get..

[tex]m=\frac{\Sigma x_i y_i -c\Sigma x_i}{\Sigma x_i ^2}[/tex]

The part I do not understand is the book says that m is equal to..

[tex]m=\frac{\Sigma (x_i-\overline{x})y_i}{\Sigma (x_i-\overline{x})^2}[/tex]

I feel like I must be missing something simple due to the books lack of explaination. Can anyone help me get this formula from the one I got for m? Why did the [itex]x_i[/itex]'s turn into [itex](x_i-\overline{x})[/itex]'s?? Did they made c=0 for some reason? Any help would be appreciated!

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Least Squares Derivation question

Loading...

Similar Threads - Least Squares Derivation | Date |
---|---|

A Confused about Weighted Least Squares | Jan 27, 2018 |

I Shaky model in least squares fit | Jun 16, 2017 |

I Hessian of least squares estimate behaving strangely | Aug 6, 2016 |

The linear in linear least squares regression | Jul 28, 2015 |

Least Squares Derivation—Simple Algebraic Simplification | Mar 15, 2015 |

**Physics Forums - The Fusion of Science and Community**