DEGREE 1–5 CURVE FIT

Polynomial Regression Calculator

Fit a polynomial of degree 1 to 5 to paired observations using a QR least-squares solve on centered and scaled X. Compare degrees, inspect conditioning warnings, residuals and the fitted curve. Higher degree is not automatically better.

QR least squaresConditioning warningsBrowser-based

YOUR DATA

Enter paired observations

Paste or upload numeric X and Y columns. Use a period as the decimal mark. Up to 5 MB and 5,000 observations are accepted.

The file is read locally in your browser.

At least degree + 1 complete pairs with enough distinct X values are needed.

How to use this calculator

  1. Paste paired X and Y values, or load the worked example.
  2. Choose a degree from 1 to 5. The calculator uses a QR solve, not the normal equations.
  3. Review the fitted equation, curve, R², RMSE and row residuals.
  4. Compare a lower-degree fit before accepting a higher-degree curve; exact interpolation (n = degree + 1) is flagged automatically.

Formula and calculation method

The model is ŷ = β₀ + β₁x + β₂x² + … + βdxd. To keep the solve numerically stable, the calculator first centres and scales X to z = (x − μ) / s, where μ is the mean X and s is the root-mean-square distance of X from μ. It then builds the Vandermonde design matrix [1, z, z², …, zd] and solves the least-squares problem with a Householder QR transformation. Coefficients are transformed back to the original X basis when the back-transformation is numerically stable; otherwise the centred/scaled form is shown.

R² = 1 − SSE/SST and RMSE = √(SSE/n). The reported reciprocal condition ratio is an estimate of the scaled design matrix’s conditioning; a very small value suggests the chosen degree may be numerically unstable for the input.

Assumptions and limitations

Related calculators

Linear regression · Quadratic regression · Exponential regression · Compare regression models