1.585714
-0.074286
1
0.99999
1.585714
-0.074286
1
0.99999
The Polynomial Regression Calculator fits a second-degree (quadratic) polynomial to your data, producing the equation y = ax² + bx + c. Polynomial regression is used when the relationship between variables follows a curved pattern that linear regression cannot capture. Common applications include modeling projectile trajectories, growth curves that level off, dose-response relationships in pharmacology, and any phenomenon where the rate of change itself changes across the range of the independent variable.
This calculator solves the normal equations for a quadratic model using Cramer's rule, providing exact coefficient values and the R² goodness-of-fit measure. Enter up to 5 data pairs to fit a parabolic curve through your data.
The quadratic polynomial regression model is:
$$y = ax^2 + bx + c$$
This can be rewritten as a multiple regression problem by defining two predictor variables: \(Z_1 = x\) and \(Z_2 = x^2\). The normal equations form a 3×3 linear system:
$$\begin{bmatrix} n & \sum x_i & \sum x_i^2 \\ \sum x_i & \sum x_i^2 & \sum x_i^3 \\ \sum x_i^2 & \sum x_i^3 & \sum x_i^4 \end{bmatrix} \begin{bmatrix} c \\ b \\ a \end{bmatrix} = \begin{bmatrix} \sum y_i \\ \sum x_i y_i \\ \sum x_i^2 y_i \end{bmatrix}$$
The calculator computes all required sums (∑x, ∑x², ∑x³, ∑x⁴, ∑y, ∑xy, ∑x²y) and then applies Cramer's rule to solve for a, b, and c. Each coefficient is the ratio of a modified determinant to the main determinant of the coefficient matrix.
The quadratic coefficient a determines the curvature: a > 0 creates a U-shaped parabola (concave up), while a < 0 creates an inverted U (concave down). The linear coefficient b affects the tilt, and c is the y-intercept. The vertex of the parabola occurs at x = -b/(2a), which represents either the minimum or maximum point of the curve.
R² is computed as 1 - SSE/SST, where SSE is the sum of squared residuals from the quadratic fit and SST is the total sum of squares. If the data truly follows a quadratic pattern, polynomial regression will yield a much higher R² than linear regression.
When analyzing polynomial regression results:
A warning about overfitting: with 5 data points and 3 parameters, a quadratic model has only 2 degrees of freedom. It will almost always fit well, but this does not mean the quadratic relationship generalizes to new data. With only 3 points, the quadratic model fits perfectly (R² = 1) regardless of the data, which is meaningless. Use polynomial regression when you have theoretical reasons to expect curvature, not just to maximize R².
Inputs
Results
A ball is thrown upward and its height (m) is recorded at time intervals (s). The quadratic fit y = -4.886x² + 9.783x + 1.469 closely models the parabolic trajectory. The negative a confirms downward curvature due to gravity (-4.886 ≈ -g/2 with air resistance). Peak height occurs at t = -b/(2a) ≈ 1.0 s.
Inputs
Results
Crop yield (bushels) vs. fertilizer (kg). The quadratic model shows diminishing returns: yield increases initially but peaks around x = -b/(2a) ≈ 38.4 kg, then declines (over-fertilization). The negative a = -0.0464 confirms the inverted-U pattern.
Use polynomial regression when your scatter plot shows a curved pattern that a straight line cannot capture. Common indicators include: residuals from linear regression showing a systematic pattern (e.g., U-shaped), domain knowledge suggesting diminishing returns or acceleration, or a substantially lower R² from linear regression compared to quadratic. If the linear R² is already high (>0.95) and residuals are random, there is no benefit to adding the quadratic term.
Yes, polynomial regression can use any degree: cubic (y = ax³ + bx² + cx + d), quartic, etc. However, higher-degree polynomials are prone to overfitting and can produce wild oscillations between data points (Runge's phenomenon). In practice, quadratic and cubic models are most common. If you need a higher degree to fit the data, consider whether a different model form (exponential, logarithmic, spline) might be more appropriate.
If the quadratic coefficient a ≈ 0, the data has minimal curvature and is essentially linear. The model reduces to y ≈ bx + c. In this case, the simpler linear model is preferable because it has fewer parameters and is easier to interpret. You can formally test whether a is significantly different from zero using an F-test or t-test on the quadratic term.
For the quadratic y = ax² + bx + c, the vertex occurs at x = -b/(2a). If a > 0, this point is a minimum; if a < 0, it is a maximum. The corresponding y-value is y = c - b²/(4a). The vertex is useful for optimization problems, such as finding the fertilizer amount that maximizes crop yield or the speed that minimizes fuel consumption.
Extrapolation with polynomial regression is extremely risky. Polynomials diverge rapidly outside the fitted range — a quadratic rises or falls without bound. Even a well-fitting polynomial can give absurd predictions just slightly beyond the data range. Always limit predictions to within (or very near) the range of observed X values. For extrapolation, consider models with asymptotic behavior (exponential decay, logistic growth) that are bounded by nature.
With few data points relative to parameters, R² can be artificially high due to overfitting. A quadratic model with 3 data points always gives R² = 1 (perfect fit), but the model has zero degrees of freedom and no predictive value. High R² can also result from a confounded relationship or a model that fits noise rather than the true signal. Always examine residuals, use adjusted R², and consider whether the model makes theoretical sense.
Roboculator Team
The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.
How helpful was this calculator?
Be the first to rate!
Linear Regression Calculator
Regression & Correlation Analysis
Simple Linear Regression Calculator
Regression & Correlation Analysis
Multiple Regression Calculator
Regression & Correlation Analysis
Exponential Regression Calculator
Regression & Correlation Analysis
Logarithmic Regression Calculator
Regression & Correlation Analysis
Power Regression Calculator
Regression & Correlation Analysis