[R-sig-ME] variance inflation factor

Toni Hernandez-Matias ahmatias at gmail.com
Thu Feb 22 13:28:16 CET 2018


Dear all,

Could some help me to calculate Variance Inflation Factors of models fitted
with glmer and lmer ?

I found the method I copy below but I am not sure it is correct:

vif.lme <- function (fit) {
     ## adapted from rms::vif
     v <- vcov(fit)
     nam <- names(fixef(fit))
     ## exclude intercepts
     ns <- sum(1 * (nam == "Intercept" | nam == "(Intercept)"))
     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 }



##la estimamos para el modelo 1

vif.lme(mod1)


Thank you very much in advance,

Antonio


-- 
*********************************************************

Antonio Hernandez Matias

Equip de Biologia de la Conservació
Departament de Biologia Evolutiva, Ecología i Ciències Ambientals
Facultat de Biologia  i Institut de Recerca de la Biodiversitat (IRBio)
Universitat de Barcelona (UB)
Av. Diagonal, 643
Barcelona      08028
Spain
Telephone: +34-934035857 <+34%20934%2003%2058%2057>
FAX: +34-934035740 <+34%20934%2003%2057%2040>
e-mail: ahernandezmatias at ub.edu

***********************************************************

	[[alternative HTML version deleted]]



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