Skip to content
Prev 16230 / 20628 Next

variance inflation factor

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