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)
}