A quartic (fourth-order) polynomial can turn three times, so it can describe W- and M-shaped patterns: a double-humped response, a potential-energy curve with two wells, or seasonal data with two peaks within the range you measured. Quartic regression finds the five coefficients that minimise the squared differences between your y values and the curve.
That flexibility is both the strength and the danger of the model. With five coefficients the curve can chase random noise, so a quartic should be backed by a reason, such as theory or a clear pattern left behind by a cubic fit. The coefficient table helps here: if the x⁴ term has a large p-value, the simpler cubic is the better choice. Adjusted R² penalises the extra parameter and is the fairer way to compare models of different degree.
You need at least five distinct x values; exactly five make the curve pass through every point, leaving no degrees of freedom to estimate error. The more points beyond five you have, the more the R² and the standard errors mean.
How to use the Quartic Regression Calculator
- x values
- y values: Same number of values as x
- Predict y at x =: Optional, leave empty to skip the prediction
- Precision (significant figures)
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
The calculator uses the columns 1, x, x², x³ and x⁴ in the normal equations, centres and scales x to keep the 5 × 5 system well conditioned, solves it, converts back to raw powers of x and reports the fit statistics with n − 5 degrees of freedom.
Worked example
Eight points from a W-shaped relationship: x = −3, −2, −1, 0, 1, 2, 2.5, 3 with y = 40.6, −0.4, 0.5, 3.6, 0.3, −0.6, 12.2, 39.5. The quartic fit is y = 1.008x⁴ − 0.02462x³ − 5.062x² + 0.08631x + 4.044 with R² = 0.99939 and adjusted R² = 0.99858. The x⁴ and x² terms are highly significant (p < 0.001), while the x³ and x terms are not (p = 0.63 and 0.81), so the curve is essentially symmetric, close to x⁴ − 5x² + 4. At x = 1.5 the model predicts −2.20.
Signs of overfitting
- R² barely improves over the cubic while adjusted R² falls.
- Coefficient p-values are large and standard errors exceed the coefficients.
- The curve swings sharply between neighbouring points.
- Predictions just outside the data are implausible.
Formula
Minimise Σ(y − a₀ − a₁x − a₂x² − a₃x³ − a₄x⁴)² · 5 × 5 normal equations (XᵀX)β = Xᵀy
Worked example
Inputs: x values: -3, -2, -1, 0, 1, 2, 2.5, 3; y values: 40.6, -0.4, 0.5, 3.6, 0.3, -0.6, 12.2, 39.5; Predict y at x =: 1.5; Precision (significant figures): 4.
Results: Regression equation = y = 1.008x⁴ − 0.02462x³ − 5.062x² + 0.08631x + 4.044; Coefficient a₄ (x⁴) = 1.00779; Coefficient a₃ (x³) = -0.024621; Coefficient a₂ (x²) = -5.062162; Coefficient a₁ (x) = 0.086308; Coefficient a₀ (constant term) = 4.044285.
Key terms
- Quartic
- A polynomial of degree four.
- Overfitting
- A model so flexible that it follows random noise rather than the underlying trend.
- Turning point
- A local maximum or minimum of the curve.
- Residual standard error
- √(SSE ÷ (n − 5)) for a quartic, the typical scatter around the curve.
Frequently asked questions
What is a quartic function?
A polynomial of degree four: y = a₄x⁴ + a₃x³ + a₂x² + a₁x + a₀. Its graph can have up to three turning points.
How many data points does quartic regression need?
At least five distinct x values; use well over five so the fit can be judged.
Why does my quartic fit look wild between points?
High-degree polynomials can oscillate when points are unevenly spaced. Add points in the gaps or use a lower degree.
Should I use quartic or cubic regression?
Fit both and compare adjusted R² and the p-value of the x⁴ coefficient. Keep the simpler model unless the quartic term is clearly significant.
Can the quartic model be used for forecasting?
Not far beyond the data, as the x⁴ term grows very fast and dominates any extrapolation.
What does R² = 1 mean here?
Usually that you entered exactly five points, so the curve interpolates them exactly. It says nothing about predictive quality.