Skip to content
Prev 44541 / 398502 Next

Comparing two regression slopes

I missed the earlier thread, but if I had the data and not just 
the table of coefficients and standard errors, then I'd try combining 
the data sets as follows: 

 > set.seed(1)
 > df1 <- data.frame(x=1:3, y=1:3+rnorm(3))
 > df2 <- data.frame(x=1:3, y=1:3+rnorm(3))
 > DF. <- data.frame(source=rep(c(-1,1), each=3), rbind(df1, df2))
 >
 > anova(lm(y~x+I(source*x), DF.))
Analysis of Variance Table

Response: y
              Df  Sum Sq Mean Sq F value Pr(>F)
x              1 0.47271 0.47271  0.5696 0.5053
I(source * x)  1 0.23386 0.23386  0.2818 0.6323
Residuals      3 2.48964 0.82988              
 >
      hope this helps.  spencer graves
Joerg Schaber wrote: