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
Source:
- https://en.wikipedia.org/wiki/Linear_regression
Graph:
- 113.032 Statistics - Linear Regression Least Squares method to 113.031 Statistics - Linear Regression
- 113.032 Statistics - Linear Regression Least Squares method to 113.033 Statistics - Residuals
- 113.031 Statistics - Linear Regression to 113.032 Statistics - Linear Regression Least Squares method
- 113.033 Statistics - Residuals to 113.032 Statistics - Linear Regression Least Squares method