Maths & numbers

Polynomial least-squares fit

Fit a low-degree curve to point data and inspect fitted values and residuals.

Polynomial least-squares fit
Esc to restore

Your inputs

Exact X,Y headings. Plain finite coordinates within ±1 billion.

Up to 25 MB per file, 50,000 data rows, 200 columns and 2 million data cells. Fully blank rows and columns are ignored before row, column and cell limits are checked. Individual tools may have smaller result or chart limits.

Results update as you type. Larger files run when you press Update result.

Your result

LOCAL & PRIVATE

Your result will appear here.

Your inputs stay in this browser. Nothing is uploaded or saved.

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

Example result
XObserved YFitted YResidual
0110
1220
2550
310100

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.