[R] vif() from Design and car

John Fox jfox at mcmaster.ca
Tue Oct 7 00:42:04 CEST 2003


Dear Rajarshi,

I don't have the book to which Frank Harrell refers in the documentation 
for the vif function in the Design package, but looking at the code for the 
function, I believe that there's an error:

vif <-
function (fit)
{
     v <- Varcov(fit, regcoef.only = TRUE)
     nam <- dimnames(v)[[1]]
     ns <- num.intercepts(fit)
#    v <- solve(v)
     if (ns > 0) {
         v <- v[-(1:ns), -(1:ns), drop = FALSE]
         nam <- nam[-(1:ns)]
     }
     d <- diag(v)^0.5
     v <- diag(solve(v/(d %o% d)))
     names(v) <- nam
     v
}

If you remove the line that I've commented-out, the function will, I 
believe, return the usual results.

I imagine that Frank can comment on this more definitively.

I hope that this helps,
  John

At 05:07 PM 10/6/2003 -0400, Rajarshi Guha wrote:
>Hi,
>   I've been generating linear models with lm(). I wanted to look at the
>VIF's for the coefficient. Using the vif() function from the package
>Design, I would get unusually high VIF's.
>
>However using vif() from the car package I get more reasonable values
>(ie in line with the quality of the model).
>
>What is the difference between the two vif functions? (I dont have
>access to the reference in the Design's vif() help page)
>
>Thanks,
>
>-------------------------------------------------------------------
>Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox




More information about the R-help mailing list