Weighted Fit Calculator

Fit noisy measurements with reliable weighted regression. Compare models, inspect residuals, and estimate uncertainties. Generate clean tables and exports instantly for lab work.

Calculator

Paste data as rows: x y or x y z.
Formula How to use
Degree 1 is a weighted straight line.
Sigma uses \(w=1/\sigma^2\). Weight uses \(w=z\).
Turn off to force the curve through the origin.
Accepted separators: spaces, tabs, commas, or semicolons. Lines starting with # are ignored.
Provide one x per line to compute \(\hat{y}\) and its 1σ uncertainty.
Reset

Example data table

Example includes uncertainties \(\sigma\) in the third column.
xysigma
01.020.10
12.050.12
22.940.09
33.980.11
44.990.10
55.920.13
Use the “Load example” button to paste these rows into the input.

Formula used

This tool performs a weighted least squares fit for a polynomial model:

y(x) = c0 + c1 x + c2 x^2 + ... + cD x^D

Each point \((x_i, y_i)\) has a weight \(w_i\). If you provide uncertainties \(\sigma_i\), the weight is \(w_i = 1/\sigma_i^2\).

Coefficients are found by solving the normal equations:

(Aᵀ W A) c = Aᵀ W y

Here \(A\) is the design matrix with polynomial basis terms, \(W\) is a diagonal matrix of weights, and \(c\) is the coefficient vector.

How to use this calculator

  1. Enter your dataset as rows of x y or x y z.
  2. Choose how to interpret the third column: uncertainty (sigma) or weight (w).
  3. Select the polynomial degree and whether to include an intercept.
  4. Optionally list x values for predictions, one per line.
  5. Press Compute weighted fit to view results above the form.
Built for lab-style datasets: readable, exportable, and practical.
Single-file tool: weighted_fit.php

Related Calculators

Optical bench alignmentLaser beam profilerM squared estimatorLens focal lengthThick lens solverRefractive index finderEtalon finesse calculatorMichelson path differenceSpectrometer wavelength calibrationGrating equation solver

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.