Deming Regression Calculator for Measurement Error

Enter paired measurements and their two constant error standard deviations. Compare the fitted lines on axes measured in error standard deviations. See how the fit adjusts both coordinates and what happens when the best line is vertical or has no unique direction.

Regression

Compare fits when both measurements have error

Paired readings and measurement errors

Enter one X and Y pair per row. Use a documented error SD for each instrument, in its own units and constant across rows.

Deming gives a unique fitted line.

Compare line slopes and intercepts

Y-to-X error variance ratio 1

Deming

Slope
1
Intercept
1

Ordinary least squares

Slope
1/2
Intercept
3/2

Weighted squared distance to each line · Deming 1 · OLS 1.2

Inspect each measured pair

Fit and adjustments in error SD units

The axes share a scale. The origin is the mean of the measured pairs.

Deming and ordinary least-squares fitsDeming gives a unique fitted line. Both axes use equal scales in measurement error standard deviations. Pair 3 has its Deming adjustment shown.Centered Y / error SDCentered X / error SD
Deming Ordinary least squares Selected pair
Measured pair (X, Y)
(2, 2)
Deming adjusted pair
(3/2, 5/2)
OLS fitted Y
5/2
View every adjusted pair
Original-unit fit ledger
PairObservedDeming (X, Y)OLS Y
1(0, 1)(0, 1)3/2
2(1, 3)(3/2, 5/2)2
3(2, 2)(3/2, 5/2)5/2

Export the measurement fit

Save the exact fit parameters and adjustments for each pair.

View CSV text

How to use this calculator

  1. Paste one X,Y measurement pair per row with the same units within each coordinate.
  2. Enter independently measured X and Y error standard deviations, such as repeated-reading SDs for each instrument.
  3. Compare Deming with ordinary least squares and use the pair selector to inspect the projected adjustment.
  4. Download CSV for exact line parameters and the measured and adjusted coordinates.

The Formula

The mathematical logic powering this calculation is:

Subtract the mean pair (x̄,ȳ), and divide each centered coordinate by its entered measurement error SD, sₓ or sᵧ. Let u=(x−x̄)/sₓ and v=(y−ȳ)/sᵧ. The common Y-to-X error variance ratio reported here is sᵧ²/sₓ². In these coordinates, Deming minimizes the sum of squared perpendicular distances.

Let A=Σu², B=Σuv, C=Σv² and Δ=√[(A−C)²+4B²]. The line passes through the center and points along the larger eigenvalue of the two-by-two scatter matrix. If B is nonzero, its slope in the plotted coordinates is (C−A+Δ)/(2B). Multiply by sᵧ/sₓ for the original-unit slope and use ȳ−mx̄ for its intercept. If B=0, the direction is horizontal for A>C and vertical for A<C. If Δ=0 all line directions through the mean are optimal.

The perpendicular projection matrix in scaled coordinates has diagonal entries ½+(A−C)/(2Δ) and ½−(A−C)/(2Δ), and off-diagonal entry B/Δ. Project each centered pair and convert back to its original units for the adjusted X and Y. The Deming weighted squared distance is (A+C−Δ)/2. When all directions tie, the objective is still available but a specific adjusted pair is undefined.

Ordinary least squares chooses the scaled slope B/A when A is positive by minimizing vertical errors. Its displayed comparison loss converts those residuals to the same squared perpendicular-distance basis used for Deming. OLS does not provide a unique slope when all predictors coincide.

Enter two to 24 pairs with decimal coordinates through ±1 trillion and up to 12 fractional places. Each positive error SD is through 1,000,000 with up to 12 places. Use fixed measurement error scales supplied separately for X and Y, independent errors on the axes, and an underlying linear relationship. The calculation estimates a line from these inputs. It does not estimate the error SDs or give inference intervals. Exact fractions and one shared radical determine all fit parameters and projections. Chart coordinates and displayed decimals are numerical views.

Worked Example

If you input:

  • Measured pairs: (0,1), (1,3), (2,2)
  • X and Y error SD: Both 1

Result:

Deming gives y=x+1 with weighted squared distance 1. Ordinary least squares gives y=x/2+3/2 and weighted perpendicular squared distance 6/5. Pair (2,2) projects to (3/2,5/2) under Deming.

Frequently Asked Questions

When does Deming differ from ordinary least squares?

Deming uses error on both coordinates and minimizes weighted perpendicular distances. Ordinary least squares holds X fixed and fits Y. A change in the supplied error variance ratio can change the Deming slope while leaving OLS unchanged.

What should I enter as the error standard deviations?

Use documented measurement error in each instrument’s original units, such as the spread from repeated measurements of a stable reference. The variability among different measured items is the fitted data, rather than the instrument error input.

How can Deming return a vertical line?

When the scaled X and Y values have zero covariance and Y has more scatter, the vertical line minimizes the perpendicular distances. Ordinary least squares may still give a horizontal response line if X varies.

Why can there be several best lines?

Equal scatter in the two scaled directions with zero covariance makes all directions through the mean equally good. No unique direction or per-pair projection exists in this case.

Similar Calculators