How this calculation works
Weighted polynomial regression fits a curve while allowing observations to contribute differently to its squared-error objective. The degree determines the shape family and an intercept is always included. This calculator rescales the x coordinates and solves a weighted least-squares design with reorthogonalized QR. It returns a query prediction, observed-versus-fitted residuals and coefficients in the stated scaled coordinate, avoiding an unexplained conversion into poorly conditioned raw powers.
Minimize Σwᵢ[p(xᵢ)−yᵢ]² using a polynomial in scaled coordinate u=(x−center)/scale.A worked example
For observations (0,1), (1,3) and (2,5) with positive weights 1,2,1, a degree-one fit recovers y=1+2x exactly. At x=3 the prediction is seven. Because all points already lie on the same line, changing their positive weights does not change that exact fit. For conflicting observations, weights do influence the optimum.
Good to know
Supports 2–100 rows and degree 0–6. Weights multiply squared residuals and must be positive; they are not automatically standard deviations. Dependent or poorly conditioned designs are rejected. Query and data magnitudes are bounded by one million. The page does not infer confidence intervals, choose the degree, apply robust outlier rejection or guarantee extrapolation accuracy.
Reference: NIST DLMF — least-squares approximations (opens in a new tab) ↗
Weights describe an objective convention
A weight of four makes a given squared residual contribute four times as much as the same residual at weight one. If weights are justified by known independent observation variances, inverse-variance weighting uses one divided by the variance. Entering the standard deviation itself would emphasize the wrong observations. The calculator does not decide whether an uncertainty model is valid for your data.
Multiplying all weights by the same positive constant leaves the fitted coefficients and predictions unchanged. It multiplies the weighted SSE by that constant. The solver normalizes weights internally to improve scale handling but restores their original objective scale in the reported SSE. This distinction separates the fitted curve from the absolute numeric value of its objective.
The Savitzky–Golay smoothing calculator with window and polynomial order fits local windows, whereas this regression fits one global weighted polynomial.
Scaled coefficients need their coordinate mapping
The step summary gives a center and scale defining u. Coefficients are in ascending powers of u, so a degree-two fit means c0+c1u+c2u². Substituting raw x directly would evaluate a different polynomial unless center is zero and scale is one. Scaling helps reduce ill-conditioning when raw coordinates have a large offset or range.
Repeated x observations are allowed because regression need not interpolate each y value; they may represent repeated measurements. Enough independent design information is still required for the chosen degree. The exact interpolation calculator instead requires distinct nodes and passes through every value. The plotted fitted values connect evaluations at observed x positions and do not prove that a high-degree curve behaves well between them. A prediction outside the observed range is extrapolation even when the numeric solver succeeds.
A few questions, answered
Does a larger degree always improve the real model?
It can reduce training error while worsening prediction or stability. Degree choice needs evidence beyond the fit’s SSE.
Can all x values be equal?
A constant degree-zero fit can still be defined. A higher-degree design is rank deficient and is rejected.