Comparing slopes of multivariate linear regression in R

1.3k views Asked by At

I am investigating size changes over time. I have five size variables in a multivariate linear model against year. I used the Anova() function in the car package to test whether the slopes are equal for each size measures. Since they proved to be significantly different I wanted to run a pairwise test for each combination of the size measures (remember, these are the response variables) but I did not manage to figure out the way how to do it. So far my code is almost the same as the one below but instead of a categorical variable I have a numeric as an explanatory variable.

names(iris) <- c("SL", "SW", "PL", "PW", "SPP")
mod.iris <- lm(cbind(SL, SW, PL, PW) ~ SPP, data=iris)
summary(mod.iris)

manova.iris <- Anova(mod.iris)
summary(manova.iris)

So using this example I want to test whether the slopes of SL to SW, SL to PL, SL to PW etc. are significantly different or not, do so for each combination and (optionally) adjust p-values. I am seeking for some post hoc test for slopes in multivariate regression.

Thanks,

Gabor

1

There are 1 answers

1
Pop On

The slopes (and intercepts) are contained in mod.iris$coefficients.

For comparing the slope of SL to the one of SW, do:

mod.iris$coefficients[1,'SL'] / mod.iris$coefficients[1,'S']

and to compare the slope of SL to SW, do:

mod.iris$coefficients[1,'SL'] / iris$SW