Deming Regression

Create Some Data

library(MethComp)

# 'True' values
M <- runif(100,0,5)

# Measurements - with generated error terms
x <- M + rnorm(100)
y <- 2 + 3 * M + rnorm(100,sd=2)

Specifying Variance

Deming regression with equal variances

Deming(x,y)
## Intercept     Slope   sigma.x   sigma.y 
##  1.753048  3.279962  1.257293  1.257293

Specifying the Variance Ratio as 2

Deming(x,y,vr=2)
## Intercept     Slope   sigma.x   sigma.y 
##  2.157498  3.112469  1.204702  1.703706

OLS Model Estimates

# Comparing classical regression and "Deming extreme"
summary(lm(y~x))
## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -11.8089  -2.0615   0.4823   2.0092   9.1973 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   4.8934     0.5433   9.006 1.73e-14 ***
## x             1.9795     0.1741  11.369  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.442 on 98 degrees of freedom
## Multiple R-squared:  0.5688, Adjusted R-squared:  0.5644 
## F-statistic: 129.3 on 1 and 98 DF,  p-value: < 2.2e-16

Plotting the Different Model Fits


Bootstrap Estimates

Deming(x,y,boot=TRUE)
## y  = alpha + beta* x
##           Estimate S.e.(boot)      50%       2.5%    97.5%
## Intercept 1.753048 1.00191990 1.749247 -0.3744253 3.430094
## Slope     3.279962 0.33099820 3.286663  2.7739982 4.050519
## sigma.x   1.257293 0.09518457 1.245123  1.0655869 1.428868
## sigma.y   1.257293 0.09518457 1.245123  1.0655869 1.428868