Skip to content
Prev 138678 / 398503 Next

testing for significantly different slopes

Thanks for the quick reply.
On Wednesday 05 March 2008, Bill.Venables at csiro.au wrote:
Thanks for the further clarification. I was hoping to get a response by using 
that example-- perhaps I should have included a bit more (to follow).
Got it.
The problem is that I would like to do a pair-wise comparison between the 
multiple slopes. For example with this model:

lm1 <- lm (Sepal.Length ~ Species/Sepal.Width -1, data=iris)

# truncated output from summary(lm1)
# just the slope terms
Speciessetosa:Sepal.Width       0.6905     0.1657   4.166 5.31e-05 ***
Speciesversicolor:Sepal.Width   0.8651     0.2002   4.321 2.88e-05 ***
Speciesvirginica:Sepal.Width    0.9015     0.1948   4.628 8.16e-06 ***

If I wanted to test the hypothesis that Speciessetosa:Sepal.Width was 
different than Speciesversicolor:Sepal.Width, what course of action should I 
take?

I have found an example in the gmodels package, using the estimable() 
function, but the documentation is not clear to me. Here is the example:

library(gmodels)

# example from manual
lm1 <- lm (Sepal.Length ~ Sepal.Width + Species + Sepal.Width:Species, 
data=iris)

cm <- rbind(
'Setosa vs. Versicolor'   = c(0, 0, 1, 0, 1, 0),
'Setosa vs. Virginica'    = c(0, 0, 0, 1, 0, 1),
'Versicolor vs. Virginica'= c(0, 0, 1,-1, 1,-1)
)

estimable(lm1, cm)

This *appears* to test what I am after, but I am not clear on how the 'cm' 
argument works.

Am I barking up the wrong tree here?

Thanks,

Dylan