# How to compare two Deming regressions?

I have two small data sets. For each data set, I performed a Deming regression. Hence, I have, for each data set, the relationship between X and Y in the form of slope+intercept coefficients.

Now, I want to know if the relationship between X and Y is the same for the two data sets. Meaning I want to compare the regressions and test whether the slope+intercept coefficients are the same. In R, there's the strucchange package allowing to run Chow Tests.

However, I understood when reading the strucchange pdf that the Chow Tests works for OLS rather than TLS, implying it does not work for Deming regressions.

Long story short: is there any function that performs the comparison of Deming regressions?

# package loading and data definition

library(MethComp)
X1=c(80,170,254,63,153,247)
Y1=c(248,252,168,283,283,142)
X2=c(80,189,292,87,189,280)
Y2=c(212,167,38,252,203,107)

# plot
x11()
plot(c(1,1),c(1,1),type="n", xlab="X value", ylab="Y value",  cex=1, xlim=c(0,300), ylim=c(0,300))
points(X1, Y1, pch=21, bg="blue", col="black", cex=1.5)
points(X2, Y2, pch=21, bg="red", col="black", cex=1.5)

# Deming regressions
for (i in 1:2) {
X=switch(i,X1,X2)
Y=switch(i,Y1,Y2)
color=switch(i,"blue","red")

dem_reg <- Deming(X,Y,vr=var(Y)/var(X))
deming_slope=dem_reg[2]
deming_intercept=dem_reg[1]
abline(a=deming_intercept,b=deming_slope,lty="longdash", col=color, lwd=2)
}


## migrated from stackoverflow.comDec 15 '16 at 8:19

This question came from our site for professional and enthusiast programmers.

• There's the boot=TRUE option to Deming which computes fitted parameter uncertainties via bootstrap sampling. For your data the estimates of slope and intercept are within the other models 2.5% - 97.5% interval so probably can't conclude any difference... – Spacedman Dec 14 '16 at 13:11
• @Spacedman: I was hesitating to do so. However, I'm not sure my question is that complicated. We'll see quickly I guess. – user137473 Dec 14 '16 at 13:14
• @Spacedman: regarding your second comment, I agree it is a reasonable method (and thanks, btw, for your time). Any official test to go with? – user137473 Dec 14 '16 at 13:23
• stats.stackexchange.com/questions/46295/… – kjetil b halvorsen Dec 16 '16 at 12:28
• clinchem.aaccjnls.org/content/clinchem/44/5/1024.full.pdf – kjetil b halvorsen Dec 16 '16 at 12:29