[R] how to test whether two slopes are sign. different?
Liaw, Andy
andy_liaw at merck.com
Mon Jul 21 14:58:36 CEST 2003
Here's the "classical" (ANCOVA?) approach, as one would learn in an applied
regression course:
summary(lm(num.book ~ pop + age + pop:age, data=your.data))
Where your.data is a data frame with at least three columns: num.book, age,
and an indicator, pop, that tells which population the subject belongs (must
be a factor). The interaction term, pop:age, gives you a test of equal
slope.
This, of course, assume that the residual variance is the same between the
two populations. It gets trickier if they're not, as Ripley pointed out.
HTH,
Andy
> -----Original Message-----
> From: Gijsbert Stoet [mailto:stoet at volition.wustl.edu]
> Sent: Sunday, July 20, 2003 10:51 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] how to test whether two slopes are sign. different?
>
>
> Hi,
>
> suppose I do want to test whether the slopes (e.g. determined with
> lsfit) of two different population are significantly
> different, how do I test this (in R). Say for example, I
> found out what the slope between age and number of books read
> per year is for two different populations of subjects (e.g.
> 25 man and 25 woman), say using lsfit. How can I tell whether
> the slopes are different in R. (And how would I do it for
> regression coefficients?)
>
> Thanks a lot for your help.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
>
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, ...{{dropped}}
More information about the R-help
mailing list