[R] vif calculation with car and HH packages

Özgür Asar oasar at metu.edu.tr
Fri Apr 13 18:49:54 CEST 2012


Dear all,

I have faced a problem while calculating VIF values via the packages, car
and HH for the models witout intercepts. Below is an illustrative example:

1) via the car package

> y<-rnorm(100,0,1)
> x1<-rnorm(100,0,1)
> x2<-rnorm(100,0,1)
> x3<-rnorm(100,0,1)
> model1<-lm(y~-1+x1+x2+x3)
> model2<-lm(y~-1+x1+x2)
>library(car)
> vif(model1)
      x1       x2       x3 
1.000279 1.019231 1.019376 
Warning message:
In vif.lm(model1) : No intercept: vifs may not be sensible.
> vif(model2)
      x1       x2 
1.000085 1.000085 
Warning message:
In vif.lm(model2) : No intercept: vifs may not be sensible.

2) via the HH package
> library(HH)
> vif(model1)
      x2       x3 
1.000557 1.000557 
> vif(model2)
Error in vif.default(xx, na.action = na.action) : 
  vif requires two or more X-variables.

I could not understand why this occured. Does anyone have any idea about it?

Best
Ozgur




-----

************************************
Ozgur ASAR

Research Assistant
Middle East Technical University
Department of Statistics
06531, Ankara Turkey
Ph: 90-312-2105309
--
View this message in context: http://r.789695.n4.nabble.com/vif-calculation-with-car-and-HH-packages-tp4555402p4555402.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list