What is the general formate for the equation of a least-squares regression line?

1 Answer
Feb 17, 2015

Equation for least-squares linear regression:

#y = m x + b#

where
# m = (sum(x_iy_i) - (sum x_i sum y_i)/n)/(sum x_i^2 -((sum x_i)^2)/n)#

and
#b = (sum y_i - m sum x_i)/n#

for a collection of #n# pairs #(x_i,y_i)#

This looks horrible to evaluate (and it is, if you are doing it by hand); but using a computer (with, for example, a spreadsheet with columns :#y, x, xy, and x^2#) it isn't too bad.