[R-sig-ME] Variance Inflation Factors

John Fox jfox at mcmaster.ca
Fri Feb 21 16:16:44 CET 2014


Dear Nick,

For a linear model, it's also possible to calculate VIFs (and generalized
VIFs) from the covariance matrix of the coefficients, and this approach
probably generalizes more readily. This is also the approach taken in the
vif() function in the car package, for which there's just an "lm" method. 

E.g., for a model fit by lmer() or glmer() in the lme4 package, the
following should work:

coef.merMod <- function(object, ...){
    fixef(object)
}
vcov.merMod <- function (object, ...){
    as.matrix(lme4:::vcov.merMod(object))
}

vif.merMod <- function(mod, ...){
    car:::vif.lm(mod, ...)
}

The first two functions are necessary because car:::vif.lm() expects coef()
to return the fixed-effect vector and vcov() to return an ordinary matrix.

I hope this helps,
 John

> -----Original Message-----
> From: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-
> models-bounces at r-project.org] On Behalf Of Nick Isaac
> Sent: February-21-14 7:42 AM
> To: Help Mixed Models
> Subject: [R-sig-ME] Variance Inflation Factors
> 
> I sent this a few days ago but it looks like the text may have been
hidden.
> Apologies if you saw it and ignored!
> 
> I have a glmer model with potential collinearity problems, so I'd like to
> estimate the Variance Inflation Factor for each of my fixed effects.
> Technically this doesn't seem challenging, but there are choices to make
and
> it's not clear to me which one is best.
> 
> I can calculating VIF for each fixed effect as 1/(1-R^2_i), where R^2_i is
the
> R^2 value from a model with the the ith fixed effect as the dependent
> variable and all others as independent variables.
> 
> Since the original model is mixed effects, I feel it would be appropriate
to
> include the random effects in each of the VIF models. Fortunately it's now
> easy to get R^2 values from mer objects using the formulae in Nakegawa &
> Schielzeth (2012), as implemented by the r.squaredGLMM() function in the
> MuMIn package.
> 
> The question is whether it would be more appropriate to use the marginal
or
> conditional R^2 value (the latter incorporates variance attributable to
random
> effects). Any opinions?
> 
> Best wishes, Nick
> 
> --
> http://drnickisaac.weebly.com/
> http://www.ceh.ac.uk/StaffWebPages/DrNickIsaac.html
> *BES Macroecology Special Interest Group
>
<http://www.britishecologicalsociety.org/getting-involved/special-interest-
> groups/macroecology/>*
> @drnickisaac
> 
> *
> <http://www.britishecologicalsociety.org/getting_involved/special_interest
> _groups/Macroecology.php>*
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


---
This email is free from viruses and malware because avast! Antivirus protection is active.



More information about the R-sig-mixed-models mailing list