开发者

Testing for multicollinearity when there are factors

is it possible to chec开发者_如何学运维k for multicollinearity in a model with Dummyvariables? Assume the following example

treatment <- factor(rep(c(1, 2), c(43, 41)), levels = c(1, 2), labels = c("placebo", "treated"))
improved <- factor(rep(c(1, 2, 3, 1, 2, 3), c(29, 7, 7, 13, 7, 21)), levels = c(1, 2, 3), labels = c("none", "some", "marked"))
numberofdrugs <- rpois(84, 5)+1
healthvalue <- rpois(84,5)
y <- data.frame(healthvalue,numberofdrugs, treatment, improved)

test <- lm(healthvalue~numberofdrugs+treatment+improved, y)

What am I supposed to do, when I want to check if multicollinearity occurs in such a model?


You can calculate the VIF for your predictors to quantify the amount of multicollinearity:

library(car)
vif(test)
                  GVIF Df GVIF^(1/(2*Df))
numberofdrugs 1.035653  1        1.017670
treatment     1.224984  1        1.106790
improved      1.193003  2        1.04510
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜