简体   繁体   中英

Comparing slopes of multivariate linear regression in R

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM