# [R] Comparing slopes of several linear models

Smit, A, Albertus, Dr ajsmit at botzoo.uct.ac.za
Tue Jul 23 11:57:50 CEST 2002

```Dear all

I have the following data (a shortened extract
shown; some replictates of time deleted) to which I
fitted the linear model given below:

time    group       mass
11      control     0.019
11      control     0.014
14      control     0.0306
14      control     0.0289
14      control     0.0236
17      control     0.0469
17      control     0.0709
11      five        0.0077
11      five        0.0101
14      five        0.0092
14      five        0.0125
17      five        0.0134
17      five        0.0143
11      ten         0.0088
11      ten         0.0092
14      ten         0.0114
14      ten         0.0113
17      ten         0.0131
17      ten         0.0154
11      twenty      0.0076
11      twenty      0.0081
14      twenty      0.0093
14      twenty      0.0091
17      twenty      0.0108
17      twenty      0.0097

> options(contrasts = c("contr.treatment",
+ "contr.poly"))
> mass.lm <- lm(mass ~ group * time, data = growth)

The question I am asking is whether the slopes
differ, which they do. This is the output:

> round(summary(mass.lm)\$coef, 3)
Estimate   SE    t value  Pr(>|t|)
(Intercept)        -0.024  0.010  -2.530    0.014
groupfive           0.027  0.013   1.998    0.051
groupten            0.025  0.013   1.840    0.071
grouptwenty         0.027  0.013   1.988    0.052
time                0.004  0.001   5.995    0.000
groupfive:time     -0.003  0.001  -3.551    0.001
groupten:time      -0.003  0.001  -3.407    0.001
grouptwenty:time   -0.004  0.001  -3.719    0.000

This essentially compares the intercepts and slopes
of groups 'five', 'ten' and 'twenty' to that of the
'control' group. But what is a simple way to
compare the slopes of groups 'five', 'ten' and
'twenty' to each other without having to do a
series of pairwise comparisons? Is there some
method involving the TukeyHSD procedure or some
other means that can be used instead?

Regards,
Albertus

Dr. Albertus J. Smit
Department of Botany
University of Cape Town
Private Bag Rondebosch
7700
South Africa
Tel. +27 21 689 3032
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```