[R] multiple pairwise slope comparisons

John Fox
Sun, 10 Mar 2002 13:05:05 -0000

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

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._