# Deming: Regression with errors in both variables (Deming regression) In MethComp: Analysis of Agreement in Method Comparison Studies

## Description

The formal model underlying the procedure is based on a so called functional relationship:

x_i=k_i + e_1i, y_i=alpha + beta k_i + e_2i

with var(e_1i)=s, var(e_2i)=VR*s, where VR is the known variance ratio.

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```Deming( x, y, vr = sdr^2, sdr = sqrt(vr), boot = FALSE, keep.boot = FALSE, alpha = 0.05 ) ```

## Arguments

 `x` a numeric variable `y` a numeric variable `vr` The assumed known ratio of the (residual) variance of the `y`s relative to that of the `x`s. Defaults to 1. `sdr` do. for standard deviations. Defaults to 1. `vr` takes precedence if both are given. `boot` Should bootstrap estimates of standard errors of parameters be done? If `boot==TRUE`, 1000 bootstrap samples are done, if `boot` is numeric, `boot` samples are made. `keep.boot` Should the 4-column matrix of bootstrap samples be returned? If `TRUE`, the summary is printed, but the matrix is returned invisibly. Ignored if `boot=FALSE` `alpha` What significance level should be used when displaying confidence intervals?

## Details

The estimates of the residual variance is based on a weighting of the sum of squared deviations in both directions, divided by n-2. The ML estimate would use 2n instead, but in the model we actually estimate n+2 parameters — alpha, beta and the n k_i's. This is not in Peter Sprent's book (see references).

## Value

If `boot==FALSE` a named vector with components `Intercept`, `Slope`, `sigma.x`, `sigma.y`, where `x` and `y` are substituted by the variable names.

If `boot==TRUE` a matrix with rows `Intercept`, `Slope`, `sigma.x`, `sigma.y`, and colums giving the estimates, the bootstrap standard error and the bootstrap estimate and c.i. as the 0.5, alpha/2 and 1-alpha/2 quantiles of the sample.

If `keep.boot==TRUE` this summary is printed, but a matrix with columns `Intercept`, `Slope`, `sigma.x`, `sigma.y` and `boot` rows is returned.

## Author(s)

Bendix Carstensen, Steno Diabetes Center, bendix.carstensen@regionh.dk, http://BendixCarstensen.com

## References

Peter Sprent: Models in Regression, Methuen & Co., London 1969, ch.3.4.

WE Deming: Statistical adjustment of data, New York: Wiley, 1943.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```# 'True' values M <- runif(100,0,5) # Measurements: x <- M + rnorm(100) y <- 2 + 3 * M + rnorm(100,sd=2) # Deming regression with equal variances, variance ratio 2. Deming(x,y) Deming(x,y,vr=2) Deming(x,y,boot=TRUE) bb <- Deming(x,y,boot=TRUE,keep.boot=TRUE) str(bb) # Plot data with the two classical regression lines plot(x,y) abline(lm(y~x)) ir <- coef(lm(x~y)) abline(-ir[1]/ir[2],1/ir[2]) abline(Deming(x,y,sdr=2)[1:2],col="red") abline(Deming(x,y,sdr=10)[1:2],col="blue") # Comparing classical regression and "Deming extreme" summary(lm(y~x)) Deming(x,y,vr=1000000) ```

MethComp documentation built on Jan. 20, 2020, 1:12 a.m.