Brett Magill
2003-Jul-21 02:12 UTC
[R] how to test whether two slopes are sign. different?
Not really r-specific: Z = (b1 - b2) / SQRT ( SEb1^2 + SEb2^2) -------Original Message------- From: Gijsbert Stoet <stoet at volition.wustl.edu> Sent: 07/20/03 09: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>
Gijsbert Stoet
2003-Jul-21 02:51 UTC
[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.
Herzog, Mark
2003-Jul-21 06:23 UTC
[R] how to test whether two slopes are sign. different?
Or better yet skip the whole "significantly" different all together, and figure out if a model with 2 slopes explains the data "better" than a model with 1------ AIC's! Mark -----Original Message----- From: Brett Magill [mailto:bmagill at earthlink.net] Sent: Sun 7/20/2003 7:12 PM To: Gijsbert Stoet; r-help at stat.math.ethz.ch Cc: Subject: Re: [R] how to test whether two slopes are sign. different? Not really r-specific: Z = (b1 - b2) / SQRT ( SEb1^2 + SEb2^2) -------Original Message------- From: Gijsbert Stoet <stoet at volition.wustl.edu> Sent: 07/20/03 09: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 > ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Harold Doran
2003-Jul-21 12:15 UTC
[R] how to test whether two slopes are sign. different?
Dear Stoet This can be handled well in using a mixed-effects model, library (nmle). You can use the lmList option to check whether the slopes differ across populations. ------ Harold C. Doran Director of Research and Evaluation New American Schools 675 N. Washington Street, Suite 220 Alexandria, Virginia 22314 703.647.1628 <http://www.edperform.net> -----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
A couple people gave you technical solutions already. My question would be, after you've determined whether they are significantly different, then what? Isn't the better question whether the two slopes are different in a substantively important way? Peter Peter L. Flom, PhD Assistant Director, Statistics and Data Analysis Core Center for Drug Use and HIV Research National Development and Research Institutes 71 W. 23rd St www.peterflom.com New York, NY 10010 (212) 845-4485 (voice) (917) 438-0894 (fax)>>> Gijsbert Stoet <stoet at volition.wustl.edu> 07/20/03 10:51PM >>>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
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}}