🧮
🧮 Math & statistics

Cubic Regression Calculator (least-squares y = ax³ + bx² + cx + d)

Results update as you type.

Your numbers

Understanding the cubic regression calculator — concept and principle

This calculator fits a cubic curve y = ax³ + bx² + cx + d to your data points by least squares. It gives the four coefficients, R², adjusted R², the standard error of the estimate and a prediction at any x. Use it when data rise and fall or curve in a way a straight line or parabola cannot follow.

Cubic through 8 pointsCubic through 8 points(9, 29.15)a · b0.130556 · −1.29524c · d4.43849 · −1.05714R²0.999173Predict x = 929.15
Least squares picks the cubic with the smallest total squared vertical gap.

How it is calculated

Choose a, b, c, d to minimise SSE = Σ(y − ŷ)², with ŷ = ax³ + bx² + cx + d.

The model is linear in its coefficients, so they solve the normal equations (XᵀX)β = Xᵀy, where X has columns 1, x, x², x³.

R² = 1 − SSE ÷ SST, with SST = Σ(y − ȳ)²

Adjusted R² = 1 − (1 − R²)(n − 1) ÷ (n − 4)

Standard error = √(SSE ÷ (n − 4))

The principle

Least squares picks the curve that keeps the vertical misses as small as possible overall, squaring them so that positive and negative errors do not cancel and large misses count more. A cubic has four free coefficients, so it can bend twice; that flexibility fits S-shaped or accelerating data, but it also means it can chase noise. Adjusted R² and the standard error account for the number of coefficients, which makes them fairer than R² alone for comparing models.

Worked example

Default inputs: x = 1 … 8, y = 2.1, 3.9, 4.2, 4.1, 5.0, 7.2, 11.5, 18.3; predict at x = 9.

  1. Least-squares coefficients: a = 0.130556, b = −1.29524, c = 4.43849, d = −1.05714.
  2. Equation: y = 0.130556x³ − 1.29524x² + 4.43849x − 1.05714.
  3. R² = 0.999173; adjusted R² = 0.998553; standard error = 0.20427 from 8 points.
  4. Prediction at x = 9: 0.130556 × 729 − 1.29524 × 81 + 4.43849 × 9 − 1.05714 = 29.15.

How to read the result

R² near 1 means the curve explains almost all the variation in y, and the standard error, about 0.2 here, is the typical size of a miss in y units. A prediction at x = 9, one step beyond the data, is plausible; predictions far outside the range are risky because cubic curves turn sharply. Always plot the data with the curve and check the residuals for patterns.

Common mistakes

Keep in mind: A good fit does not prove the cubic model is the right description. Use subject knowledge and test the model on new data before relying on it.

Frequently asked questions

What is cubic regression used for?

Modelling data that curve with up to two bends, such as growth that slows and then speeds up.

How many points do I need?

At least 4 distinct x values; many more are needed for a meaningful fit.

What does adjusted R² add?

It penalises extra coefficients, so it does not automatically rise when the model gets more complex.

Sources: NIST/SEMATECH e-Handbook of Statistical Methods, §4.1.4.1 Linear Least Squares Regression

Checked 9 Nov 2026. NIST/SEMATECH e-Handbook of Statistical Methods, §4.1.4.1 Linear Least Squares Regression (polynomial models such as β₀ + β₁x + β₁₁x² are linear in the parameters; estimates minimise the sum of squared deviations). R², adjusted R² and standard error: standard formulas with n − 4 residual degrees of freedom.

🧮 All math & statistics tools →🌍 Calculators by country →