[英]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. 我在汽车包装中使用了Anova()函数来测试每个尺寸度量的斜率是否相等。 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. 因此,使用此示例,我想测试SL到SW,SL到PL,SL到PW等的斜率是否存在显着差异,请针对每种组合进行此操作,并(可选)调整p值。 I am seeking for some post hoc test for slopes in multivariate regression. 我正在寻找一些多元回归斜率的事后检验。
Thanks, 谢谢,
Gabor 的Gabor
The slopes (and intercepts) are contained in mod.iris$coefficients
. 斜率(和截距)包含在mod.iris$coefficients
。
For comparing the slope of SL to the one of SW, do: 为了将SL的斜率与SW的斜率进行比较,请执行以下操作:
mod.iris$coefficients[1,'SL'] / mod.iris$coefficients[1,'S']
and to compare the slope of SL to SW, do: 并比较SL与SW的斜率,请执行以下操作:
mod.iris$coefficients[1,'SL'] / iris$SW
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.