Re: [R] Compare linear regressios for significant differences of the slopes
Dieter Menne wrote: > Rainer M Krug wrote: >>> I have (8 measures * 96 groups) = 768 datasets for which I did linear >>> regressions using lm(). Sorry for my (probably incorrect) usage of "group" and "measure". Here a (probably better) description of my design: I ran 96 different simulations (spread of a species along a transect) over four generations, based on different parameter sets. These resulted in 96 results (groups). Now I have 8 different ways to describe the result of one simulation based on x individuals further away then distance d, where x is replaced by 1, 5, 10, 50, 100, 500, 1000 and 5000 (measures). For each group / simulation, I did linear regressions for each measure > lm.measure_1 <- lm(distance ~ generation) ... resulting in lm.measure_1 to lm.measure_8 Within each group (based on one simulation), I get a different slope for each measure. What I want to know is if these resulting slopes differ within one group / simulation. >>> >>> Now I want to compare the slopes for each of the 8 measures in each of >>> the 96 groups. As I understand , I can not use anova(lm1, ..., lm8) >>> as the lm1 ... lm8 are based on different datasets. >>> > > Instead of doing this in two steps, you would better use lme in package nlme > to > test the hypothesis in one run. I don't understand the details of you design, > but is looks like the oxboys example in Pinheiro/Bates (the book of nlme) > could > give you a first starter. > > Dieter > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Compare linear regressios for significant differences of the slopes
Hi I haven't received any ideas yet - I just wanted to confirm if this is a simple question? Should I follow the idea of checking if slope +- stddev slope overlap? Thanks, Rainer Rainer M Krug wrote: > Hi > > I have (8 measures * 96 groups) = 768 datasets for which I did linear > regressions using lm(). > > Now I want to compare the slopes for each of the 8 measures in each of > the 96 groups. As I understand , I can not use >> anova(lm1, ..., lm8) > as the lm1 ... lm8 are based on different datasets. > > I also read in previous discussions in this list, that I can see if the > slope +- stddev(slope) overlap, but this seems a long process for the > huge number of comparisons. > > Therefore my question: is there a way to compare the slopes of lm() > which are based on different datasets and what is the easiest way to do > it for this large number of datasets? > > Thanks in advance for your help, > > Rainer > -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Compare linear regressios for significant differences of the slopes
Hi I have (8 measures * 96 groups) = 768 datasets for which I did linear regressions using lm(). Now I want to compare the slopes for each of the 8 measures in each of the 96 groups. As I understand , I can not use > anova(lm1, ..., lm8) as the lm1 ... lm8 are based on different datasets. I also read in previous discussions in this list, that I can see if the slope +- stddev(slope) overlap, but this seems a long process for the huge number of comparisons. Therefore my question: is there a way to compare the slopes of lm() which are based on different datasets and what is the easiest way to do it for this large number of datasets? Thanks in advance for your help, Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.