Quadratic Regression Calculator
Fit a quadratic and a straight line to the same x and y observations. Compare their residuals and training error on a common scale. Inspect the exact centered equation, see what supports the curvature term, and check whether the fitted turning point falls within the observed x range.
Quadratic regression explorer
Fit a curve to observed pairs and compare its errors with a straight-line fit.
Observed x and y pairs
Enter 3–200 pairs in two columns, without a header. Separate x and y with a comma, a tab or whitespace.
Straight-line and quadratic fits
5 observations · 5 distinct x values
| Model | RMSE | R² | Residual SSE |
|---|---|---|---|
| Straight line | 2.1725561 | 0.0166666667 | 23.6 |
| Quadratic | 0.302371578 | 0.980952381 | 0.457142857 |
Fitted y = ax² + bx + c
- a
- 1.28571429
- b
- 0.2
- c
- 0.428571429
Standardized condition number 1.
A higher value means the centered predictor and its squared term are closer to alignment after standardization.
Show exact centered equation
t = x − (0)
ŷ = (9/7)t² + (1/5)t + (3/7)
Fitted minimum at x -0.0777777778, y 0.420793651. Within the observed x range.
These fit metrics use the entered observations. A lower training error can result from adding a term.
Plot coordinates are offsets from the sample means, x̄ 0 and ȳ 3.
- Observed
- Straight line
- Quadratic
- Turning point
Each residual is the observed y minus its fitted value.
Observation and residual ledger
| Row | Entered x | Entered y | Line fitted | Line residual | Quadratic fitted | Quadratic residual |
|---|---|---|---|---|---|---|
| 1 | -2 | 5 | 2.6 | 2.4 | 5.17142857 | -0.171428571 |
| 2 | -1 | 2 | 2.8 | -0.8 | 1.51428571 | 0.485714286 |
| 3 | 0 | 0 | 3 | -3 | 0.428571429 | -0.428571429 |
| 4 | 1 | 2 | 3.2 | -1.2 | 1.91428571 | 0.0857142857 |
| 5 | 2 | 6 | 3.4 | 2.6 | 5.97142857 | 0.0285714286 |
How to use this calculator
- Paste 3 to 200 observed pairs in two columns. Separate x and y by a comma, tab or whitespace. Keep each row's x and y together.
- Compare Straight-line and quadratic fits. Repeated x values each contribute an observation. At least three distinct x values are needed to estimate curvature.
- Review the fitted coefficients and exact centered equation. Check the standardized condition number and whether the fitted turning point lies within the observed x range.
- Inspect the plotted fits and select a residual series. The residual scale stays fixed as you switch between the models.
- Review the Observation and residual ledger. Download quadratic regression CSV for exact coefficients, fitted values and residuals.
The Formula
The mathematical logic powering this calculation is:
The quadratic model ŷ = ax² + bx + c and straight-line model ŷ = mx + k each minimize the sum of squared residuals on the same data. Center t = x − x̄. Orthogonalize the squared term by setting u = t² − mean(t²), then w = u − t × Σ(tu)/Σt². The coefficient on the extra term is a = Σ[w(y − ȳ)]/Σw². The straight-line slope is m = Σ[t(y − ȳ)]/Σt². The centered fit is ŷ = ȳ + mt + aw, and the equivalent expanded coefficients are in the results.
The standardized condition number measures how strongly the centered predictor and its squared term align after each is scaled to unit length. With correlation magnitude |r| between t and u, it equals (1 + |r|)/√(1 − r²). A large number indicates near dependence between those two columns. The exact rank comes from the entered distinct x values. Fitting the quadratic needs at least three distinct x values.
When a ≠ 0, the fitted turning point is x = −b/(2a), a minimum for positive a and a maximum for negative a. The observed range includes its endpoints for this comparison. A zero fitted a yields no isolated turning point. The graph marks a turning point when it lies in range.
Residual = observed y − fitted y. SSE = Σ residual², RMSE = √(SSE/n), and R² = 1 − SSE/Σ(y − ȳ)² when y varies. The CSV also gives residual standard deviation with denominator n minus the number of fitted parameters when degrees of freedom are positive. These values describe fit to the entered observations.
Enter 3–200 pairs, using signed decimal or scientific numbers up to ±1 trillion and 12 effective decimal places. Explicit exponents must lie from −12 to 12. Means, coefficients, residuals, SSE, R² and turning-point coordinates use exact rational arithmetic. Displayed square roots, condition number and graph coordinates are numerical approximations.Worked Example
If you input:
- Observed x, y pairs: (−2,5), (−1,2), (0,0), (1,2), (2,6)
Result:
The line has RMSE about 2.17256 and R² about 0.01667. The quadratic is ŷ = (9/7)x² + (1/5)x + 3/7, with RMSE about 0.30237 and R² about 0.98095. Its fitted minimum occurs at x = −7/90 and y = 2651/6300, within the observed x range.
Frequently Asked Questions
What is quadratic regression?
It estimates the coefficients a, b and c that minimize squared differences between the observed y values and ax² + bx + c. Input is a set of observed pairs. When coefficients are already known, a quadratic equation calculator can solve for its roots.
Why does the quadratic training error usually decrease?
The quadratic contains the straight line as the special case where a equals zero. Adding the term can lower the error on the same observations. Evaluating whether that improvement generalizes calls for new data or a separate validation design.
Can I use repeated x values?
Yes. Each repeated observation remains in the fit. Two distinct x values support a line. Three or more distinct values are needed to estimate the quadratic curve.
What does the standardized condition number mean?
It describes the alignment of the centered predictor and its squared term after standardizing the two columns. One means those two columns are orthogonal. Larger values mean the design has less separation between them. Exact arithmetic keeps the reported fit for the supplied observations.
Is the turning point an observed maximum or minimum?
It is the fitted curve's minimum or maximum. Its location is compared with the observed x range. If the fitted turning point is outside the range, it describes an extrapolated feature. If the quadratic term is zero, there is no isolated turning point.
Why is R² unavailable for constant y?
Every observed y equals its mean, so the total sum of squares is zero. Both fits reproduce the constant response and have zero RMSE. The R² ratio is undefined.
What does the NIST Pontius example contain?
It loads the 40 observed load-cell calibration pairs in the NIST Statistical Reference Datasets collection. The published reference includes the quadratic coefficients, R² and residual sum of squares.
Similar Calculators
Linear Regression Calculator
Fit a least-squares line, inspect scatter and residual plots, and calculate Student-t confidence and prediction intervals. Paste paired data and export the full ledger.
Exponential Regression Calculator
Fit an exponential curve to observed pairs using log-linear least squares. Compare residuals on both scales, forecast a new x and export CSV.
Quadratic Formula Calculator
Solve any quadratic equation ax² + bx + c = 0 and find its real or complex roots instantly.
Polynomial Division Calculator
Divide polynomials using long or synthetic division. Inspect each step, the exact quotient and remainder, and the reconstruction identity.
