"Comparing two regression line slopes"
I knew the method based on the following statement :
t = (b1 - b2) / sb1,b2
where b1 and b2 are the two slope coefficients and sb1,b2 the pooled
standard error of the slope (b)
which can be calculated in R this way:
> df1 <- data.frame(x=1:3, y=1:3+rnorm(3))
> df2 <- data.frame(x=1:3, y=1:3+rnorm(3))
> fit1 <- lm(y~x, df1)
> s1 <- summary(fit1)$coefficients
> fit2 <- lm(y~x, df2)
> s2 <- summary(fit2)$coefficients
> db <- (s2[2,1]-s1[2,1])
> sd <- sqrt(s2[2,2]^2+s1[2,2]^2)
> df <- (fit1$df.residual+fit2$df.residual)
> td <- db/sd
> 2*pt(-abs(td), df)