keisoku

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

0.0760.711.0382.1223.532.9624.943.9246.3x = 1, y = 3.1, weight = 4x = 2, y = 5.2, weight = 6x = 3, y = 9.1, weight = 3x = 4, y = 16.8, weight = 5x = 5, y = 27.2, weight = 2x = 6, y = 40.9, weight = 1

Data and predicted values

No.xyWeightPredictedResidual
113.143.3141-0.2141
225.264.88010.3199
339.139.3952-0.2952
4416.8516.8594-0.0594
5527.2227.2727-0.0727
6640.9140.63510.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

  1. Home
  2. Weighted Quadratic Regression Calculator