Polynomial Regression Calculator
Free polynomial regression calculator. Fit degree 1–6 polynomials. R², adjusted R², AIC, BIC for mod
Why This Statistical Analysis Matters
Why: Statistical calculator for analysis.
How: Enter inputs and compute results.
Polynomial Regression — Model Comparison
Fit degree 1–6 polynomials. Compare R², adjusted R², AIC, BIC. Select best model. View residuals and turning points.
Real-World Scenarios — Click to Load
Paste from Clipboard
| x | y | |
|---|---|---|
Scatter with Polynomial Curve (Degree 3)
R² / Adjusted R² / AIC by Degree
Residuals (Degree 3)
Calculation Breakdown
Model Comparison
| Degree | R² | Adj R² | AIC | BIC | Best |
|---|---|---|---|---|---|
| 1 | 0.9552 | 0.9463 | 21.39 | 21.29 | — |
| 2 | 1.0000 | 1.0000 | -Infinity | -Infinity | AIC & BIC |
| 3 | 1.0000 | 1.0000 | -Infinity | -Infinity | — |
| 4 | 1.0000 | 1.0000 | -Infinity | -Infinity | — |
| 5 | 1.0000 | 1.0000 | -345.89 | -346.21 | — |
| 6 | 1.0000 | 0.0000 | -Infinity | -Infinity | — |
For educational and informational purposes only. Verify with a qualified professional.
Key Takeaways
- Model: y = β₀ + β₁x + β₂x² + ... + βₖxᵏ (degree k). Vandermonde matrix X: Xᵢⱼ = xᵢʲ.
- Normal equations: β = (X'X)⁻¹X'y. Solve via least squares.
- R² = 1 − SS_res/SS_tot. Adjusted R² = 1 − (1−R²)(n−1)/(n−k−1).
- AIC = n×ln(SS_res/n) + 2(k+1). BIC = n×ln(SS_res/n) + ln(n)(k+1). Lower is better.
- Best degree: Minimize AIC or BIC to balance fit vs complexity.
- Overfitting: If adjusted R² decreases or degree approaches n, simplify.
- Turning points: Roots of derivative p'(x)=0 indicate local minima/maxima.
Did You Know?
How Polynomial Regression Works
1. Vandermonde matrix
Build X where Xᵢⱼ = xᵢʲ. Each row is [1, xᵢ, xᵢ², ..., xᵢᵏ].
2. Normal equations
Solve (X'X)β = X'y. β contains the polynomial coefficients.
3. R² and adjusted R²
R² = 1 − SS_res/SS_tot. Adjusted R² penalizes extra parameters.
4. AIC and BIC
AIC = n×ln(SS_res/n) + 2(k+1). BIC adds ln(n) factor. Choose degree that minimizes these.
5. Prediction and residuals
ŷ = β₀ + β₁x + ... + βₖxᵏ. Residuals: eᵢ = yᵢ − ŷᵢ.
6. Turning points
Solve p'(x)=0 for roots. Degree k polynomial has at most k−1 turning points.
Expert Tips
Minimum sample size
Use at least k+2 points for degree k. More points reduce overfitting.
Check residuals
Residuals should be random. Patterns suggest a different model.
Prefer AIC/BIC
R² always increases with degree. Use AIC or BIC to choose the best model.
Avoid extrapolation
Polynomials can diverge wildly outside the data range.
Degree Comparison
| Degree | Parameters | Best For |
|---|---|---|
| 1 (Linear) | 2 | Straight-line relationships |
| 2 (Quadratic) | 3 | Parabolic curves, one hump/valley |
| 3 (Cubic) | 4 | S-curves, two turning points |
| 4 | 5 | More complex curvature |
| 5 | 6 | Highly flexible curves |
| 6 | 7 | Maximum flexibility (risk overfitting) |
When to Use Polynomial vs Linear Regression
| Scenario | Use |
|---|---|
| Straight-line relationship | Linear (degree 1) |
| U-shape, one hump/valley | Quadratic (degree 2) |
| S-curve, two turning points | Cubic (degree 3) |
| Complex curvature, inflection | Quartic or higher |
| Plateau or saturation | Consider exponential/logistic instead |
Frequently Asked Questions
When should I use polynomial vs linear regression?
Use polynomial when the relationship shows curvature (U-shape, S-curve, plateau). Linear is for roughly straight-line relationships.
What is the best degree?
Minimize AIC or BIC. If adjusted R² decreases with higher degree, use the simpler model.
What does overfitting mean?
The model fits noise instead of signal. High R² but poor predictions on new data. Use AIC/BIC and residual plots.
Can I extrapolate with polynomial regression?
Cautiously. Polynomials can diverge quickly outside the data range. Prefer interpolation.
Why does R² always increase with degree?
More parameters allow a tighter fit. Adjusted R², AIC, and BIC penalize complexity to avoid overfitting.
What are turning points?
Points where the curve changes direction (local min/max). A degree-k polynomial has at most k−1 turning points.
Polynomial Regression by the Numbers
Official Data Sources
Disclaimer: Polynomial regression can overfit with few points or high degree. Use AIC/BIC and adjusted R² for model selection. Avoid extrapolation outside the data range.
Related Calculators
Cubic Regression Calculator
Fit a cubic polynomial y = ax³ + bx² + cx + d to data using least squares. R², prediction, residuals, and comparison with linear and quadratic fits.
StatisticsQuadratic Regression Calculator
Fit y = ax² + bx + c to data using least squares. Vertex, axis of symmetry, R², comparison with linear fit, residuals, F-test.
StatisticsLinear Regression Calculator
Full simple linear regression: y = a + bx. Slope, intercept, R², standard errors, t-tests for coefficients, confidence and prediction intervals, ANOVA table.
StatisticsExponential Regression Calculator
Fit y = ae^(bx) or y = ab^x to data using log-linear regression. R², prediction, doubling/halving time, and residuals.
StatisticsCoefficient of Determination Calculator (R-squared)
Computes R², adjusted R², and related measures of fit from data or summary statistics. Explains how much variance in Y is explained by X.
StatisticsAbsolute Uncertainty Calculator
Computes absolute uncertainty, relative (percentage) uncertainty, and propagates uncertainties through arithmetic operations. Essential for physics...
Statistics