[R] test the significances of two regression lines

Luis Ridao Cruz Luisr at frs.fo
Mon Aug 6 12:32:50 CEST 2007


R-help,

I'm trying to test the significance of two regression lines
, i.e. the significance of the slopes from two samples
originated from the same population.

Is it correct if I fit a liner model for each sample and
then test the slope signicance with 'anova'. Something like this:

lm1 <- lm(Y~ a1 + b1*X)    # sample 1
lm2 <- lm(Y~ a2 + b2*X)    # sample 2

anova(lm1, lm2)

Thanks in advance.



More information about the R-help mailing list