| Deming {MethComp} | R Documentation |
The function makes a regression of y on x, assuming that both x and y are measured with error. This problem only has an analytical solution if the ratio of the variances is known, hence this is required as an input parameter.
Deming(x, y, vr = sdr^2, sdr = sqrt(vr),
boot = FALSE, keep.boot = FALSE, alpha = 0.05)
x |
numerical variable. |
y |
numerical variable. |
vr |
The assumed known ratio of the (residual) variance of the
ys relative to that of the xs. 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? |
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.
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).
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.
Bendix Carstensen, Steno Diabetes Center, http://www.biostat.ku.dk/~bxc.
Peter Sprent: Models in Regression, Methuen & Co., London 1969, ch.3.4.
WE Deming: Statistical adjustment of data, New York: Wiley, 1943. [This is a reference taken from a reference list — I never saw the book myself].
# Some data x <- runif(100,0,5) + rnorm(100) y <- 2 + 3 * x + 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)