How it’s calculated
Polynomial regression fits a curve ŷ = b₀ + b₁x + b₂x² (+ b₃x³ + b₄x⁴) that minimises the sum of squared vertical distances to the points, exactly like linear regression but with extra powers of x. It suits data that rise and then fall (or the reverse). R² is the share of the variation in y that the curve explains; adjusted R² penalises the extra coefficients, and the F-test asks whether the curve explains more than a flat line would by chance.
To stay accurate, the calculator first rescales x to the range −1 to 1 and solves the least-squares problem with a QR decomposition rather than the textbook normal equations, which lose precision for large x or high degrees. The coefficients are then converted back to your original x.
Example (Handbook of Biological Statistics, LibreTexts): carapace length (mm) and clutch size of 18 gopher tortoises. The best-fit quadratic is ŷ = −899.9 + 5.857x − 0.009425x² with R² = 0.4338 (0.43 with 15 degrees of freedom, P = 0.014), while a straight line explains only 1.5%. At x = 310 mm the curve predicts about 10.05 eggs. These are the default values.
Higher degrees always raise R², so do not choose a degree just because R² goes up; watch adjusted R² and the shape of the curve, and avoid predicting outside the range of your data.
Frequently asked questions
Which degree should I use?
The lowest one that captures the shape: quadratic for one bend, cubic for an S shape. Higher degrees chase noise. A good fit should also make sense for what you are measuring.
What does R² mean here?
The fraction of the variation in y explained by the curve, from 0 to 1. It always increases with the degree, which is why adjusted R² is shown as well.
Why can the predictions be absurd outside my data?
Polynomials shoot off to plus or minus infinity beyond the data. In the tortoise example the quadratic predicts negative clutch sizes for very small or very large tortoises.
How many points do I need?
At least one more than the degree, with that many different x values. With exactly degree + 1 points the curve passes through all of them and R² is 1, which tells you nothing; use many more points than coefficients.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- Handbook of Biological Statistics (McDonald), 5.3 Curvilinear (Nonlinear) Regression — LibreTexts
- NIST/SEMATECH e-Handbook, 4.1.4.1 Linear Least Squares Regression — NIST
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator