Polynomial least-squares fit
Fit a low-degree curve to point data and inspect fitted values and residuals.
A clear answer. Here’s how.
Fits 1st–5th degree polynomials to 2–500 observations using reorthogonalised QR, requiring more observations than degree and independent design columns. X is centred/scaled to t=(X−centre)/scale; coefficients are reported in ascending powers of t. Exports fitted values and residuals, with residual sum of squares in the note. No confidence intervals, weighting or predictive validity is inferred.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- CSV: X,Y
X,Y 0,1 1,2 2,5 3,10
- Polynomial degree
- 2
Example result
| X | Observed Y | Fitted Y | Residual |
|---|---|---|---|
| 0 | 1 | 1 | 0 |
| 1 | 2 | 2 | 0 |
| 2 | 5 | 5 | 0 |
| 3 | 10 | 10 | 0 |
Least-squares QR fit in t=(X−1.5)/1.5. Ascending coefficients [t⁰,t¹,…]: 3.25, 4.5, 2.25. Residual sum of squares 0. Fit is descriptive; extrapolation can be unstable.