Skip to content

Polynomial Regression Calculator

Fit a curved relationship between two variables when a straight line clearly does not capture the pattern, using a quadratic or cubic term you explicitly choose in advance.

What this answers

This calculator answers "how well does a curved relationship of a specific, chosen shape fit these two variables?" It requires you to declare the curve's degree up front rather than searching for whatever degree fits best, since letting the degree float freely invites overfitting.

How it is calculated

A quadratic fit adds an x-squared term alongside x itself; a cubic fit adds an x-cubed term as well. Both cases reduce to an ordinary multiple regression on these power-transformed columns, solved by the exact same least-squares machinery this site's Multiple Linear Regression Calculator uses, not a separate curve-fitting algorithm.

Worked example

For x values of negative 2 through 2 and y values equal to x squared exactly, the quadratic fit recovers an intercept of 0, a linear coefficient of 0, and a quadratic coefficient of exactly 1, with an R-squared of 1, correctly identifying the perfect underlying parabolic relationship.

Assumption audit

Calculated from your data: every coefficient in the fitted polynomial and the resulting R-squared, plus whether enough distinct x values exist to support the chosen degree.
Evidence to review: whether the fitted curve makes sense across the full range of your data, not just where you have observations; polynomial curves can swing wildly just beyond the range of the data used to fit them, an especially serious risk with a cubic term.
You must verify: that a genuine curved relationship, not just noise or a couple of extreme points, justifies the chosen degree; a higher-degree polynomial will always fit your specific sample better, whether or not that improvement reflects anything real.

What this result does not mean

A high R-squared for a polynomial fit does not mean the true relationship is exactly that shape; it only means this particular curve, of the degree you chose, matches your observed points well. Never extrapolate a polynomial fit meaningfully beyond the range of x values it was actually fit on.

Limitations

This calculator caps the degree at 3, since higher-degree polynomials become increasingly unstable and prone to overfitting with typical dataset sizes; it also requires enough distinct x values to support the requested degree, and duplicate x values (repeated measurements at the same point) are allowed as long as that minimum is met.