存在因素时检验多重共线性 [英] Testing for multicollinearity when there are factors

查看:44
本文介绍了存在因素时检验多重共线性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用虚拟变量检查模型中的多重共线性?假设下面的例子

is it possible to check 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?

推荐答案

您可以计算 VIF 让您的预测变量量化多重共线性的数量:

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

这篇关于存在因素时检验多重共线性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆