Skip to content
Statistics

Cubic Regression Calculator

Enter your x and y data points (one pair per line, or separated by semicolons) to fit the cubic polynomial y = a + bx + cx² + dx³ using ordinary least squares. You get the four coefficients, the coefficient of determination (R²), the root-mean-square error, and a chart showing the fitted curve against your data. You need at least 4 points to fit a cubic model.

Your details

Enter pairs as "x,y" separated by semicolons or new lines. Example: 0,1; 2,0; 3,3. At least 4 pairs required.
Number of decimal places shown for the coefficients and statistics.
Cubic equationExcellent fit
y = 0.9973 - 5.0755x + 3.0687x² - 0.3868x³

The fitted polynomial y = a + bx + cx² + dx³

Intercept (a)0.9973
Linear (b)-5.0755
Quadratic (c)3.0687
Cubic (d)-0.3868
R² (coefficient of determination)0.9997
RMSE0.0328
Data points5
0.9997
Poor fit<0.6Moderate fit0.6-0.8Good fit0.8-0.95Excellent fit0.95+
-1.41.885.16036
x
  • Fitted cubic
  • Data points

Cubic fit from 5 points: an excellent fit (R² = 0.9997).

  • The model is: y = 0.9973 - 5.0755x + 3.0687x² - 0.3868x³.
  • R² = 0.9997 means the cubic polynomial explains 100.0% of the variance in y.
  • The RMSE is 0.0328, the average absolute prediction error in the same units as your y values.
  • With very few points a near-perfect R² can be misleading because the model has little room to differ from the data.

Next stepUse the fitted equation to predict y values by substituting x. Check the chart: if the curve misses clusters of points, a different polynomial degree may fit better.

What is cubic regression?

Cubic regression fits a third-degree polynomial of the form y = a + bx + cx² + dx³ to a dataset. It is an extension of linear and quadratic regression that can capture S-shaped curves, inflection points, and data with two local turning points. The method is useful when a scatter plot shows a shape that neither a straight line nor a parabola follows well. Like all polynomial regression, the fitting is done by ordinary least squares: the four coefficients a, b, c, d are chosen to minimise the sum of squared differences between the observed y values and the values the polynomial predicts.

How the calculation works

The least-squares fit leads to a system of four linear equations called the normal equations: XᵀX · β = Xᵀy, where X is the design matrix whose rows are [1, x, x², x³] for each data point. Solving this 4x4 system with Gaussian elimination gives the coefficient vector β = [a, b, c, d]. This calculator uses partial pivoting for numerical stability. The coefficient of determination R² = 1 - SSres / SStot measures how well the polynomial explains the variability in y, ranging from 0 (no explanatory power) to 1 (perfect fit). The RMSE is the square root of the average squared residual, expressed in the same units as y, giving an intuitive sense of the average prediction error.

When to use cubic regression

Choose cubic regression when your scatter plot shows an S-shape or a curve with one inflection point that a parabola cannot capture. Common applications include growth curves that plateau then decline, dose-response relationships in pharmacology, population dynamics over time, and physical phenomena such as fluid flow or stress-strain curves. Cubic regression is also a standard tool in exploratory data analysis when you want to go one degree beyond quadratic without jumping to a complex non-linear model. A key warning: with fewer than about 10 points, a cubic curve can overfit the data, producing a high R² that does not generalise to new observations. Always inspect the fitted-curve chart alongside the R² value.

Reading the results

The intercept a is the predicted y when x = 0. The linear coefficient b describes the initial slope at x = 0. The quadratic coefficient c controls the curvature of the parabolic component. The cubic coefficient d governs the S-shaped twist: when d is large relative to the others, the cubic term dominates and the curve changes direction noticeably. R² tells you the fraction of variance explained - values above 0.90 are usually considered good in social and physical sciences, but acceptable thresholds vary by field. RMSE lets you ask a practical question: on average, how far are the predictions from the real values in y-units? Compare RMSE to the range of your y values to judge whether it is practically meaningful.

R² interpretation guide

R² rangeInterpretationAction
0.95 - 1.00 Excellent fit Model explains nearly all variance
0.80 - 0.94 Good fit Reliable for most purposes
0.60 - 0.79 Moderate fit Consider adding points or checking outliers
0.00 - 0.59 Poor fit Relationship may not be cubic; inspect the chart

General benchmarks for assessing cubic regression fit quality. Thresholds are context-dependent.

Frequently asked questions

How many data points do I need for cubic regression?

You need at least 4 points because a cubic polynomial has 4 parameters (a, b, c, d). With exactly 4 points, the curve passes exactly through all of them and R² = 1 by construction, which is not a useful model. In practice, aim for at least 8 to 10 points so the fit is meaningful and R² reflects genuine explanatory power rather than interpolation.

What does a high R² mean?

R² (coefficient of determination) measures the proportion of total variance in y that the cubic polynomial explains. A value of 0.90 means 90% of the variance is explained by the model. However, a high R² does not guarantee the model is appropriate: with very few points a cubic curve nearly passes through every point regardless of the true relationship, inflating R². Always pair R² with a visual check of the fitted curve.

What is the difference between cubic and quadratic regression?

Quadratic regression fits a degree-2 polynomial y = a + bx + cx², which is a parabola with a single turning point (maximum or minimum). Cubic regression adds a dx³ term, allowing the curve to have up to two local extrema and one inflection point where the curvature changes sign. Use cubic regression when the data shows an S-shape or when a quadratic fit leaves a clear curved pattern in the residuals.

Can I use this calculator for prediction?

Yes. Once you have the coefficients a, b, c, d, substitute any x value into y = a + bx + cx² + dx³ to predict y. Be cautious about extrapolating far beyond the range of your original data: cubic polynomials grow without bound as x increases or decreases, so predictions far outside the observed range can be highly unreliable.

What does RMSE tell me?

Root-mean-square error (RMSE) is the square root of the average squared residual. It is in the same units as your y values, making it easy to interpret: an RMSE of 2.5 with y values ranging from 0 to 50 means predictions are off by about 2.5 units on average. Lower RMSE indicates a tighter fit, but comparing RMSE values is only meaningful between models trained on the same dataset.

Sources

Written by Dr. Hannah Brandt, PhD Statistician · Munich, Germany

Applied statistician translating rigorous probability theory into clear, accurate tools for researchers and practitioners.

Search 3,500+ calculators

Loading search…