[R] Compare linear regressios for significant differences of the slopes
Rainer M Krug
RKrug at sun.ac.za
Fri Nov 3 14:11:21 CET 2006
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 at 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: RKrug at sun.ac.za
Rainer at krugs.de
More information about the R-help
mailing list