Linear Least Squares Regression
For a general linear equation, y=mx+b, it is assumed that the errors in the y-values are substantially greater than the errors in the x-values. The vertical deviation can be calculated using this formula:
If the square of the deviations is minimized, the "best line" can be calculated:
By the use of matrix algebra (determinants), the values of the slope (m) and the y-intercept (b) can be calculated.
A short review of determinants:
Given: | Example: |
It is evaluated: | Equals: |
Now, the values for m, b, and the deviation D can be determined by these matrices:
The regression form which is available submits the entered data to a perl script, which calculates the above matrices and graphs the data with the regression line.
Notice that this theory assumes the data are basically linear! If data for a curve is passed to this program, it still calculates a straight line. Deciding which type of regression fits best is the user's responsibility.