[R] multiple pairwise slope comparisons

John Janmaat jjanmaat at acadiau.ca
Mon Mar 11 15:02:46 CET 2002

John Fox wrote:

> At 06:36 AM 3/10/2002 -0400, John Janmaat wrote:
>> I have a linear model with different slopes for different treatment 
>> groups.  I need to pairwise compare the different slope estimates for 
>> the different treatment groups.  Is there a package that does pairwise 
>> comparisons of slope coefficients, making the appropriate adjustments 
>> in the P values?
> Dear John,
> I'm not aware of anything that does this directly, but there are several 
> simple ways of making these comparisons.
> For example, if you use treatment contrasts (the default in R) and fit a 
> model with a constant, then the coefficients for the interaction will 
> give you slope comparisons with the the baseline category (and the 
> associated t- and p-values). You could then use the linear.hypothesis 
> function in the car package to compare other pairs of slopes (via pairs 
> of coefficients for the interaction), or, alternatively, refit the model 
> with different baseline categories until you have all of the pairwise 
> slope comparisons.
> Once you have the p-values for the pairs, you could use p.adjust to get 
> adjusted p-values, compute Scheffe tests, or whatever you had in mind.
> If this is something that you need to do a lot, it wouldn't be hard to 
> write a small function to implement the procedure.
> I hope that this helps,
>  John


Thanks for the comment.  I have actually set up the multiple treatment 
groups with dummy variables in a regression model.  I programmed up a 
Tukey (from Zarr's Biometrics) to compare the differences.

If I understand your outline, I should just be able to calculate the P 
values or simple pairwise t tests between my coefficients of interest, 
and use p.adjust to make the multiple comparison correction.  Is this 



John Janmaat
Department of Economics
Acadia University, Wolfville, NS, B0P 1X0

All opinions stated are personal, unless
otherwise indicated.

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

More information about the R-help mailing list