113 Math
113.032 Statistics - Linear Regression Least Squares method

Least Squares Method

Least Squares is the most common method to calculate a linear regression.

To calculate the equation of the least squares line
- Start with the usual slope equation y = mx + b
- Calculate the mean and standard dev of both x and y
- Calculate the r coefficient (get a number between -1 and 1)
- Replace the mean of x and y in the slope equation
- Calculate m equals m = (StdDev(y) * r) / StdDev(x)
- Calculate b equals b = Mean(y) - (m * Mean(x)). You now have the value of m so just swap that in.
- Now you can complete the initial equation with the new values for m and b

  • statistics