Comparison of two curves

1

Hello I have to follow a determination of Anvisa RDC 166/2017 and one of the things she asks is the comparison of two straight lines through the tilt, intercept and calculation of coincidence. Of the three calculations I could only do the coincidence, as shown below:

Comp=read.csv(file="C:/Users/porti/OneDrive/Script/efeito_matriz.csv",sep=";")
Comp

X1<-(Comp$"ï..X1")
X1
Y1<-(Comp$"Y1")
Y1
X2<-(Comp$"X2")
X2
Y2<-(Comp$"Y2")
Y2

x = c(X1, X2) 
y = c(Y1, Y2) 
z = factor(c(rep(1, length(X1)), rep(2, length(X2)))) 
z
C1 = lm(y~x*z) 
C2 = lm(y~x) 
anova(C1, C2) 

Does anyone have an idea how I can compare the intercept and slope of these two curves?

    
asked by anonymous 31.07.2018 / 03:33

1 answer

1

If you do

summary(C1)

will have the similar result:

# Coefficients:
#   Estimate Std. Error t value Pr(>|t|)    
# (Intercept)  9.72936    0.58273   16.70   <2e-16 ***
#   x            2.01814    0.02864   70.47   <2e-16 ***
#   z           10.47969    0.74020   14.16   <2e-16 ***
#   x:z          0.96228    0.03382   28.45   <2e-16 ***

It indicates that the intercept for the second case X2 would be (9.72 + 10.47) and its difference is significant. The same can be done for the slope, for X2 case would be (2.02 + 0.96) also significant, this with simulated data.

You can see this in a chart:

plot(y~x, col=z)
abline(a=9.72936,b=2.01814,col=3)
abline(a=9.72936+10.47969,b=2.01814+0.96228,col=4)

Youcancheckthisbydoing:

X1a=c(X1,rep(0,length(X2)))X2a=c(rep(0,length(X1)),X2)c3=lm(y~0+z+X1a+X2a)summary(c3)car::linearHypothesis(c3,"1*z1 - 1*z2 = 0")
car::linearHypothesis(c3,"1*X1a - 1*X2a = 0")
    
31.07.2018 / 16:25