Quartic Regression & Held-Out Fit Calculator

Paste observed coordinates to fit a quartic and three lower-degree polynomial models. Compare ordinary training errors with predictions made for held-out observations. Inspect individual residuals and leverage, expand coefficients in x, and find which supported degree first meets your error limit.

Polynomial fit comparison

Compare quartic training and held-out fit

Fit the same observations at four degrees and see how each model predicts the observations it leaves out.

Quartic training RMSE
1.13017828
9 entered observations
Quartic held-out RMSE
4.69144406
Error across all omitted observations
Lowest held-out error
Quadratic
Compares degrees with complete held-out results
Lowest degree within limit
Quadratic
Limit 2.5
Edit observations and error limit

Paste one decimal pair per line with a comma, tab or spaces between values.

Training and held-out RMSE by degree

Select a degree to inspect its curve and residuals. Both bars use the same error scale. The dashed marker is your held-out RMSE limit.

Training RMSE10.7661163
Held-out RMSE15.5684901
Training RMSE1.25003126
Held-out RMSE1.99126148
Training RMSE1.24782961
Held-out RMSE3.2652394
Training RMSE1.13017828
Held-out RMSE4.69144406

Quartic curve and observed pairs

Quartic fitted curve and 9 observationsThe horizontal axis is x. The vertical axis is y. Points show the observed values. The solid line gives fitted y. The selected observation is outlined.
-44
Y range 3 to 35. The curve spans the observed x range. The outlined point matches the selected observation.

Inspect an observation

Entered x
-4
Observed y
32
Fitted y
31.991453
Training residual
0.00854700855
Leverage
0.956487956
Omitted prediction
31.8035714
Held-out residual
0.196428571
Review exact coefficients

Centered coordinates use t = (x − center) / half-span. Expanded coefficients use x directly.

Exact x center
0
Exact x half-span
4
Training SSE
1345/117
Training R²
121271/122616
PRESS
109663509972692432524529/553613342185312360000

Centered coefficient

Intercept
589/143
t^1
254/297
t^2
10214/429
t^3
112/297
t^4
2272/429

Expanded coefficient

Intercept
589/143
x^1
127/594
x^2
5107/3432
x^3
7/1188
x^4
71/3432
Download polynomial fit CSV
Show selectable CSV

How to use this calculator

  1. Paste 2 to 60 observed x and y pairs, one row per observation. Use a comma, tab or spaces between values and leave out any header.
  2. Choose a degree from one through four. Read its training and held-out errors beside the other degrees.
  3. Inspect the plotted curve, then choose an observation to see its fitted and omitted predictions separately.
  4. Enter an optional held-out RMSE limit to see the lowest degree that meets it across every observation.
  5. Expand the exact coefficients or download the CSV with all supported degrees, fits and row-level results.

The Formula

The mathematical logic powering this calculation is:

The calculator fits degrees 1 through 4 by ordinary least squares with one intercept and equal weight per observation. Center c = (minimum x + maximum x) / 2, half-span s = (maximum x − minimum x) / 2, and t = (x − c)/s. The design row v is [1, t, t², …, tᵈ]. With X assembled from these rows, solve XᵀX β = Xᵀy exactly when at least d + 1 distinct x values are present. The coefficient ledger shows both this centered equation and the expanded polynomial in x.

A training residual is e = observed y − fitted y. Training RMSE = √(Σe²/n). With h = v (XᵀX)⁻¹ vᵀ for each row, the omitted residual is e/(1 − h). This gives the error that results from fitting the same degree without that observation and predicting it at its x. If h = 1 exactly, the omitted fit lacks enough distinct x values to identify the coefficients. The row stays in the ledger, and a degree with any failed omission has no aggregate leave-one-out error.

PRESS sums the squared omitted residuals across the full set of observations. Held-out RMSE = √(PRESS/n). All degrees with complete omissions use the same rows for comparison. The smallest exact PRESS identifies the lowest held-out error, with exact ties retained. An optional RMSE limit compares PRESS with n × limit², including equality, and returns the lowest degree that passes.

Enter 2 to 60 decimal observation pairs, each coordinate between −1 trillion and 1 trillion and up to 12 fractional digits. Enter a limit between 0 and 1 trillion, or leave it blank. Repeated x values remain separate observations. The training and omitted residuals, rank, comparisons and coefficients use exact rational arithmetic. Displayed square roots and chart coordinates are approximations.

Leave-one-out error describes prediction within the supplied sample design. Nearby, repeated, chronological or grouped observations can make single-row omission an unsuitable validation strategy. An omitted endpoint prediction may also lie outside that omitted fit’s training range. The plot draws the full-data fit over the observed x range.

Worked Example

If you input:

  • Observed x and y pairs: (−4,32), (−3,18), (−2,11), (−1,5), (0,3), (1,6), (2,13), (3,18), (4,35)
  • Held-out RMSE limit: 2.5

Result:

The quartic training RMSE is about 1.13017828 and its held-out RMSE is about 4.69144406. The quadratic held-out RMSE is about 1.99126148. Degree 2 has the smallest held-out error and is the lowest degree under the entered limit.

Frequently Asked Questions

What distinguishes a quartic from a quadratic or cubic?

A quartic model includes an x⁴ term and can use all lower powers. The curve still qualifies as a fitted degree-four model if the estimated coefficient on x⁴ is exactly zero.

Why can the quartic improve training error while increasing held-out error?

Additional terms can follow fluctuations in the supplied observations. If the fitted coefficients shift when an observation is removed, predictions for omitted observations can deteriorate even as the full-data fit improves.

Why can five distinct coordinates support a quartic fit with no held-out error estimate?

Five distinct x values identify five coefficients. If each appears once, one omission leaves only four distinct x values. The remaining observations no longer determine the quartic coefficients.

What if two models have the same held-out error?

They both appear among the exact best degrees when their PRESS ties. The separate error-limit result uses the smallest degree that meets your entered limit.

Does a repeated x value count?

Each repeated x remains its own observation with its own fitted and omitted residuals. Repeated rows increase sample count while preserving the number of distinct x values used to determine model rank.

Which coefficients should I use in another worksheet?

Use the centered coefficients with t = (x − center)/half-span, or use the expanded coefficients directly with x. The CSV provides both as exact fractions. The centered form can reduce rounding cancellation when x shares a large common offset.

Similar Calculators