Advertisement

Polynomial regression calculator

Enter matching predictor and response lists to fit the model and predict at a chosen x value.

Calculator

Predicted response
81.000000
R squared
1.000000
Residual sum of squares
0.000000
Residual degrees of freedom
0.000000
Residual standard deviation status
Undefined (no residual degrees of freedom)
Coefficients in original x units
CoefficientEstimate
b00.000000
b10.000000
b20.000000
b30.000000
b41.000000
Fitted observations
xObserved yPredicted yResidual
-2.00000016.00000016.0000000.000000
-1.0000001.0000001.0000000.000000
0.0000000.0000000.000000-0.000000
1.0000001.0000001.0000000.000000
2.00000016.00000016.0000000.000000

Advertisement

How this calculator works

Choose a degree from one to eight and fit all powers through that degree, including the intercept. Householder QR works on a centred, scaled predictor rather than solving normal equations. A unique fit requires at least degree + 1 distinct, well-spaced x values. Higher degree can reduce training error while worsening prediction.

Formula

ŷ = Σ(j = 0 to d) bj x^j; minimise Σ(y - ŷ)²; residual df = n - d - 1.

Worked example

For x = -2, -1, 0, 1, 2 and y = 16, 1, 0, 1, 16, degree 4 recovers y = x⁴ and predicts 81 at x = 3.

Advertisement

Frequently asked questions

How should I choose degree?

Use subject knowledge and validation on new data. A larger training R squared alone does not justify extra terms.

What order are coefficients shown in?

b0 is the intercept, b1 multiplies x, b2 multiplies x squared, and so on.

Why reject nearly singular data?

Repeated or tightly clustered predictor values can make high-degree coefficients numerically indeterminate.

Sources

Advertisement