[R] How to compare two regression line slopes

2009-01-27 Thread Etienne Toffin
Hi, I've made a research about how to compare two regression line slopes (of y versus x for 2 groups, group being a factor ) using R. 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

Re: [R] How to compare two regression line slopes

2009-01-27 Thread Ben Bolker
Etienne Toffin etoffin at ulb.ac.be writes: I've made a research about how to compare two regression line slopes (of y versus x for 2 groups, group being a factor ) using R. I knew the method based on the following statement : t = (b1 - b2) / sb1,b2 where b1 and b2 are the two slope

Re: [R] How to compare two regression line slopes

2009-01-27 Thread Zhou Fang
Hi, Yes, the two methods are equivalent. The p-value R calculates is based on the same t-statistic used in your manual analysis. You can see this by doing the second method: y2 = rbind(df1, df2) y2 = cbind(c(0,0,0,1,1,1), y2) summary(lm(y2[,3] ~ y2[,1] + y2[,2] + y2[,2]*y2[,1])) Look at the

Re: [R] How to compare two regression line slopes

2009-01-27 Thread Zhou Fang
Hi, Yes, the two methods are equivalent. The p-value R calculates is based on the same t-statistic used in your manual analysis. You can see this by doing the second method: y2 = rbind(df1, df2) y2 = cbind(c(0,0,0,1,1,1), y2) summary(lm(y2[,3] ~ y2[,1] + y2[,2] + y2[,2]*y2[,1])) Look at the