Deming Regression Calculator

Deming Regression Calculator

The regression for comparing two assays, where both axes carry measurement error. Ordinary least squares assumes the comparative method is exact, and systematically under-estimates the slope when it is not.

Deming Regression

Summary statistics + λ → slope
The mean of all the results from the established or comparative method across the paired samples. X is conventionally the method you already trust; it is not assumed to be error-free, which is the whole point of Deming.
The spread of the X results across the samples — the range of concentrations the comparison covered. This is not the method's imprecision. A method comparison should span the measuring interval, so this number is normally large.
The mean of the results from the new or candidate method on the same samples, in the same unit.
The spread of the Y results across the same samples, again the range covered rather than the imprecision.
The correlation across the paired samples. It is used here only to reconstruct the cross-product term; it is not a measure of agreement and this page makes no claim about agreement from it. Must be positive for a method comparison — a negative correlation means something is wrong with the pairing.
The ratio of the two methods' ANALYTICAL error variances, Y over X. From your own CVs: λ = (CV_Y × mean_Y)² ÷ (CV_X × mean_X)². λ = 1 means the two methods are equally imprecise and gives orthogonal regression. Conventions differ between software packages, so check yours: with this formula a large λ should reduce to ordinary least squares of Y on X.
1.072slope, Y on XExample

A candidate method against the current one on patient samples spanning the measuring interval: X mean 5.00 with SD 2.20, Y mean 5.30 with SD 2.35, correlation 0.95, and both methods taken to be equally imprecise so λ = 1

Formula

Sxx = SDX² · Syy = SDY² · Sxy = r × SDX × SDY

slope = [(Syy − λSxx) + √((Syy − λSxx)² + 4λSxy²)] ⁄ (2Sxy)
intercept = ȳ − slope × x̄

λ = var(error in Y) ⁄ var(error in X)
λ — state it, always
with THIS formula λ is the analytical error variance of the Y method divided by that of the X method. Software packages differ on which way up they write it, and an inverted λ shifts the slope in the wrong direction without any warning from the arithmetic. Two checks settle it for any implementation: a very large λ must reduce to ordinary least squares of Y on X, and a very small λ must reduce to the inverse of ordinary least squares of X on Y
λ = 1
orthogonal regression — the line that minimises the perpendicular distances from the points. It is the right default when the two methods have similar imprecision, and it is what most laboratories use because reliable imprecision figures for both methods at the same concentration are rarely to hand
getting λ from your CVs
λ = (CVY × meanY)² ÷ (CVX × meanX)², using each method's own long-term internal quality control CV at a concentration near the mean of the comparison. If the two methods have similar CVs at similar concentrations, λ is close to 1 and the choice barely matters
Sxx, Syy, Sxy
the second moments. The slope formula is homogeneous in all three together, so the (n − 1) factor cancels and the sample variances can be used in place of the sums of squares — which is why this page can take two SDs and a correlation rather than asking for raw data
why not ordinary least squares
it minimises the vertical distances only, which assumes X is measured without error. When X carries error, the slope is attenuated towards zero by roughly the reliability of X. On simulated data with a true slope of 1.20 and error SDs of 1.0 in X and 2.0 in Y, ordinary regression returns 1.08 and Deming with the correct λ returns 1.20
Passing-Bablok
the non-parametric alternative: the median of the pairwise slopes, with no assumption that the errors are normal and no requirement that the ratio of error variances stays constant across the interval. Prefer it when there are outliers you cannot justify excluding, when the error distribution is clearly non-normal, or when the scatter changes shape across the measuring interval. Deming is the better choice when the assumptions hold, and weighted Deming when the imprecision is proportional to concentration
no confidence interval here
a Deming slope has no usable closed-form standard error. Linnet's recommendation, which MedCalc and Analyse-it both implement, is a jackknife over the paired observations; a bootstrap works too. Both need the raw pairs, which this page does not take, so it prints no interval. Do not quote a Deming slope as evidence of agreement without one from software that has the data
what the regression does not tell you
how far apart two individual results will be. A slope of 1.00 and an intercept of 0 are entirely compatible with wide limits of agreement, because the line describes the average relationship and says nothing about the scatter about it. Run the difference plot as well; CLSI EP09c asks for both

Worked example

A candidate method against the current one on patient samples spanning the measuring interval: X mean 5.00 with SD 2.20, Y mean 5.30 with SD 2.35, correlation 0.95, and both methods taken to be equally imprecise so λ = 1
Sxx = 2.20² = 4.840, Syy = 2.35² = 5.5225, Sxy = 0.95 × 2.20 × 2.35 = 5.0925
Syy − λSxx = 5.5225 − 4.840 = 0.6825
√(0.6825² + 4 × 1 × 5.0925²) = √(0.4658 + 103.732) = 10.2176
slope = (0.6825 + 10.2176) ⁄ (2 × 5.0925) = 10.9001 ⁄ 10.1849 = 1.072
intercept = 5.30 − 1.072 × 5.00 = −0.060 — so Y ≈ 1.072X − 0.060: a 7% proportional difference with essentially no constant offset
Ordinary least squares on the same numbers gives Sxy ⁄ Sxx = 5.0925 ⁄ 4.840 = 1.015. That is the attenuation: ignoring the error in X has shrunk the estimated slope by 5.6%, in the direction of concealing the proportional difference
The direction is not a coincidence. Ordinary least squares always pulls the slope towards zero by roughly the reliability of X, so it systematically under-states a proportional bias — which is the one failure mode a method comparison exists to detect
Change λ to 4, meaning the candidate method is twice as imprecise as the comparative one, and the slope falls to 1.038; change it to 0.25 and it rises to 1.104. Check which way your software defines λ before reading any of this: with the formula above, a large λ should collapse towards the ordinary least squares value of 1.015

The same data, five values of λ

λ = var(Y error) ⁄ var(X error)MeansSlopeInterceptReduces to
0.25 — X four times as imprecise1.104−0.222Towards the inverse of least squares of X on Y (1.124)
0.501.090−0.151
1.00 — equally impreciseOrthogonal regression1.072−0.060
2.001.053+0.035
4.00 — Y four times as imprecise1.038+0.112Towards least squares of Y on X (1.015)
The slope moves by 6% across this range, and it moves monotonically, which is what makes an inverted λ so dangerous: the answer stays plausible and is wrong in a consistent direction. The two end columns are the self-test. Whatever software you use, push λ very high and very low; with the formula on this page the high end must approach the ordinary least squares slope of Y on X and the low end must approach the inverse of least squares of X on Y. If yours does the opposite, its λ is defined the other way up.

Which regression for a method comparison

MethodAssumesUse it whenInterval for the slope
Ordinary least squaresX measured without error; normal, constant-variance residuals in YAlmost never in a method comparison. It is right for a calibration curve against prepared standards, where X really is knownClosed form, and biased along with the slope
DemingError in both, ratio of error variances known and constantThe standard choice for comparing two measurement procedures when the imprecision is roughly constant across the intervalJackknife or bootstrap; no closed form
Weighted DemingError in both, imprecision proportional to concentrationWhen the CV is roughly constant rather than the SD — which is most immunoassays across a wide rangeJackknife or bootstrap
Passing-BablokError in both, constant ratio of error variances, no distributional assumptionOutliers you cannot justify removing, clearly non-normal errors, or scatter that changes shape across the intervalNon-parametric, from the distribution of pairwise slopes
Bland-Altman difference plotDifferences roughly normal and independent of magnitudeAlways, alongside whichever regression you chose. It answers a different question: how far apart are two individual results?Confidence interval of the limits of agreement
CLSI EP09c carries appendices for ordinary, weighted, Deming, weighted Deming and Passing-Bablok regression, and defines the difference plot separately, because a method comparison needs both a regression and an agreement analysis. The regression finds systematic differences and locates them; the difference plot says whether one patient's result would change. Neither of them says whether the difference is acceptable: for that, the slope and intercept have to be turned into a predicted bias at each medical decision concentration and compared with the allowable error, which is what the method comparison acceptance interpreter does.

Why ordinary least squares is the wrong tool, and which way up λ goes

Ordinary least squares regression minimises the vertical distances from the points to the line. That is the correct thing to do when the horizontal axis is known exactly — a calibration curve against gravimetric standards, say — and it is the wrong thing to do when the horizontal axis is another assay. In a method comparison both axes carry measurement error, and the consequence of ignoring the error in X is not random: the estimated slope is attenuated towards zero, by roughly the reliability of X. On simulated data with a true slope of 1.20 and error standard deviations of 1.0 in X and 2.0 in Y, ordinary least squares returns 1.08. The bias goes in the single most unhelpful direction available, because a method comparison exists to detect proportional differences and ordinary regression systematically shrinks them.

Deming regression fixes this by minimising a weighted sum of both distances, with the weights given by the ratio of the two methods' error variances. That ratio is λ, and it is the one parameter you have to supply. With the formula on this page — and this is the sentence to keep — λ is the error variance of the Y method divided by the error variance of the X method. From your own quality control it is (CV of Y × mean of Y)² over (CV of X × mean of X)². When the two methods are equally imprecise λ is 1, the weighting becomes symmetric, and Deming regression reduces to orthogonal regression, which minimises the perpendicular distances. That is the default most laboratories use, because reliable imprecision figures for both methods at the same concentration are rarely to hand.

Getting λ the wrong way up is a real hazard rather than a theoretical one, because the conventions in circulation genuinely differ and the answer stays plausible either way. On the worked example, λ = 4 gives a slope of 1.038 and λ = 0.25 gives 1.104: both look like reasonable method comparison results and they differ by 6%. Two limit checks settle it for any software, and they take a minute. Push λ very large: the slope should converge on the ordinary least squares slope of Y on X, because a large λ means X is relatively error-free. Push λ very small: it should converge on the inverse of the ordinary least squares slope of X on Y. If your package does the opposite, its λ is defined the other way up, and everything you have computed with it needs revisiting.

Deming has assumptions of its own. The ratio of error variances is taken to be constant across the measuring interval, which fails whenever imprecision is proportional to concentration rather than constant — the usual situation for an immunoassay spanning three decades. Weighted Deming exists for exactly that, and CLSI EP09c carries it as a separate appendix. The errors are also assumed to be approximately normal, and a handful of outliers will pull the line. Passing-Bablok is the non-parametric alternative: it takes the median of all the pairwise slopes, makes no distributional assumption, and is largely unmoved by outliers. Prefer it when there are extreme points you cannot justify excluding, when the errors are clearly not normal, or when the scatter changes shape across the interval. Deming is the better estimator when its assumptions hold, and neither is a substitute for looking at the plot.

Two things this page cannot give you. The first is a confidence interval for the slope: a Deming slope has no usable closed form, and the standard approach — Linnet's, implemented in MedCalc and Analyse-it alike — is a jackknife over the paired observations, with bootstrapping as an alternative. Both need the raw pairs. A slope of 1.072 means something quite different if its interval runs from 1.04 to 1.10 than if it runs from 0.92 to 1.22, and the usual test of whether a method comparison passes is whether the interval contains 1. Get the interval from software that has the data. The second is any statement about agreement. A regression line describes the average relationship between the two methods and says nothing about the scatter about it, so a slope of 1.00 with an intercept of 0 is entirely compatible with limits of agreement too wide to use. Run both; the regression tells you whether there is a systematic difference and where, and the difference plot tells you whether one patient's result would change.

Frequently asked questions

Why not use ordinary least squares for a method comparison?

Because it assumes the X method is measured without error, and in a method comparison it is not. The consequence is a slope biased towards zero by roughly the reliability of X, which systematically understates the proportional difference between the two methods — the very thing the comparison was done to find. On simulated data with a true slope of 1.20 and error SDs of 1.0 and 2.0, ordinary regression returns 1.08 while Deming with the correct variance ratio returns 1.20.

What is lambda in Deming regression?

The ratio of the two methods' analytical error variances. With the formula used here it is the error variance of Y divided by the error variance of X, obtained from your own quality control as (CV of Y × mean of Y)² over (CV of X × mean of X)². λ = 1 means the methods are equally imprecise and gives orthogonal regression. Conventions differ between software packages, so check: with this formula, a very large λ must reduce to ordinary least squares of Y on X.

How do I know whether my software has lambda the right way up?

Run two extreme values. Set λ very large: the slope should converge on the ordinary least squares slope of Y on X, because a large λ means X is relatively error-free. Set λ very small: it should converge on the inverse of the ordinary least squares slope of X on Y. If your package behaves the other way round, its λ is the reciprocal of the one in the formula on this page.

When should I use Passing-Bablok instead of Deming?

When the assumptions Deming needs are not met: outliers you cannot justify excluding, errors that are clearly not normally distributed, or scatter that changes shape across the measuring interval. Passing-Bablok takes the median of all the pairwise slopes, so it is non-parametric and robust. Where Deming's assumptions do hold it is the more efficient estimator, and weighted Deming handles the common case of imprecision proportional to concentration.

What is the confidence interval for a Deming slope?

There is no usable closed form. The standard approach, from Linnet and implemented in MedCalc and Analyse-it, is a jackknife over the paired observations, with a bootstrap as an alternative; both need the raw data rather than summary statistics. The usual acceptance test is whether the interval for the slope contains 1 and the interval for the intercept contains 0, and neither can be answered from a point estimate alone.

Does a slope of 1.00 mean the two methods agree?

No. A regression line describes the average relationship between the two methods across the range; it says nothing about how far apart two results on the same sample will be. A slope of 1.00 with an intercept of 0 is entirely compatible with limits of agreement too wide to be clinically acceptable. Run a Bland-Altman difference plot alongside the regression — CLSI EP09c asks for both because they answer different questions.

Related calculators

References

  1. Linnet K. Evaluation of regression procedures for methods comparison studies. Clin Chem. 1993;39(3):424–432.
  2. Linnet K. Estimation of the linear relationship between the measurements of two methods with proportional errors. Stat Med. 1990;9(12):1463–1473.
  3. Passing H, Bablok W. A new biometrical procedure for testing the equality of measurements from two different analytical methods. Part I. J Clin Chem Clin Biochem. 1983;21(11):709–720.
  4. CLSI EP09c. Measurement Procedure Comparison and Bias Estimation Using Patient Samples. 3rd ed. Clinical and Laboratory Standards Institute; 2018.
  5. Bilić-Zulle L. Comparison of methods: Passing and Bablok regression. Biochem Med (Zagreb). 2011;21(1):49–52.

Medical Disclaimer: The tools and content provided here are for educational and reference purposes only. They are not intended to substitute for professional medical advice, diagnosis, or treatment. Clinical decisions should always be based on the comprehensive assessment of a qualified healthcare professional.