Evaluating numerical algorithm
Linear Least Squares Regression finds the best-fit line by minimizing the sum of squared vertical distance errors (residuals) between raw sample data points and the regression line!
Fit a straight line to the 5 observation pairs:
| x | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| y | 2 | 3 | 5 | 4 | 6 |
| x | y | x² | x · y |
|---|---|---|---|
| 1 | 2 | 1 | 2 |
| 2 | 3 | 4 | 6 |
| 3 | 5 | 9 | 15 |
| 4 | 4 | 16 | 16 |
| 5 | 6 | 25 | 30 |
| Sum = 15 | Sum = 20 | Sum = 55 | Sum = 69 |
Plug sums into system with :
The straight line of best fit calculated by linear least squares is y = 1.3 + 0.9x!