Weighted Quadratic Regression Calculator
Fit a quadratic curve y = a + b x + c x² to weighted data points using weighted least squares. Shows the coefficients a, b, c, the coefficient of determination R², the vertex, and the total weight, plus a scatter plot whose point sizes scale with the weight and the fitted parabola.
Input
Enter (x, y, weight) data points, one per line. A missing weight is treated as 1. The calculator fits the quadratic regression y = a + b x + c x² using weighted least squares.
One point per line, separated by commas or spaces. A line without a weight is treated as weight 1.
Result
Regression equation
y = 4.6971 − 2.8576 x + 1.4745 x²
Constant a
4.697126
Linear term b
-2.857603
Quadratic term c
1.474544
R² (fit)
0.9994
Total weight
21
Point count
6
Vertex
( 0.969 , 3.3126 )
The quadratic term is positive, so the parabola opens upward.
Scatter plot and fitted parabola
Data and predicted values
| No. | x | y | Weight | Predicted | Residual |
|---|---|---|---|---|---|
| 1 | 1 | 3.1 | 4 | 3.3141 | -0.2141 |
| 2 | 2 | 5.2 | 6 | 4.8801 | 0.3199 |
| 3 | 3 | 9.1 | 3 | 9.3952 | -0.2952 |
| 4 | 4 | 16.8 | 5 | 16.8594 | -0.0594 |
| 5 | 5 | 27.2 | 2 | 27.2727 | -0.0727 |
| 6 | 6 | 40.9 | 1 | 40.6351 | 0.2649 |
How it works
- Each data point (x, y) carries a weight w, and the calculator finds the coefficients a, b, c that minimize the weighted residual sum of squares Σ w (y − (a + b x + c x²))². A weight w is treated as if the point were observed w times.
- Setting the partial derivatives with respect to a, b, c to zero yields the weighted normal equations, a system of three linear equations in which every sum is multiplied by the weight w.
- The resulting system is solved with Gaussian elimination using partial pivoting to obtain a, b, and c.
- The coefficient of determination R² uses the weighted mean ybar = Σ w y / Σ w and is computed as R² = 1 − Σ w (y − yhat)² / Σ w (y − ybar)². Values close to 1 indicate a good fit.
- The vertex of the parabola is found from dy/dx = b + 2 c x = 0, giving x = −b / (2c). The curve opens upward when c is positive and downward when c is negative.
- Enter one point per line as x, y, weight separated by commas or spaces. A line without a weight is treated as weight 1, and weights must be positive.
- At least three points with differing x values are required. If all x values are equal or the points lie on a straight line or a constant, the quadratic coefficient may be undetermined.
Reviews
Tell us what you think of this calculator.
Write a review
- Home
Weighted Quadratic Regression Calculator