PDA

View Full Version : Homogeneity of regression slopes with R



lucac1980
01-20-2009, 10:35 AM
Is anyone familiar with the problem of testing the homogeneity of regression slopes using R?

Let's suppose I have a continuous dependent variable Y, a continuous indipendent variable X and a set of GROUPS (indipendent categorical variable) (subset being, e.g., C, C1, C2, C3). I intend to test the homogeneity of the regression slopes of each group obtained plotting Y against X. Moreover, I want to compare the slopes between them (sort of contrast test).
Practically speaking, I thought of running an analysis of covariance and then create an anova table to check the homogeneity of slopes assumption by testing the significance of the interaction term, something like that:
> data.ancova <- lm(X~1+Y+GROUPS+Y:GROUPS, data=data)
> anova(data.ancova)
In this way I can test whether the different slopes are homogeneous, but I can't figure out which slope differs from which other... Does anybody have any idea what code might be run in order to have comparisons among slopes?