[R-sig-ME] variance inflation factor

Toni Hernandez-Matias ahmatias at gmail.com
Thu Feb 22 17:08:27 CET 2018


Thank you very much John and Ben for your messages and the information that
really helps me.

Best regards,

Antonio

On Thu, Feb 22, 2018 at 5:01 PM, Fox, John <jfox at mcmaster.ca> wrote:

> Dear Toni,
>
> > -----Original Message-----
> > From: Toni Hernandez-Matias [mailto:ahmatias at gmail.com]
> > Sent: Thursday, February 22, 2018 10:01 AM
> > To: Fox, John <jfox at mcmaster.ca>
> > Cc: r-sig-mixed-models at r-project.org
> > Subject: Re: [R-sig-ME] variance inflation factor
> >
> > Dear John,
> >
> > Thank you very much for your message.
> >
> > Did you know a bibliographic reference for this method, specifically in
> the case
> > of generalized linear mixed models?
>
> Sorry, I don't, but don't see why the general idea wouldn't apply here (as
> Ben mentioned in his response). By the way, the more general vif() function
> in the car package works for lme() in nlme but not for lmer() or glmer() in
> lme4 (because the result returned by vcov() for a "merMod" object isn't of
> class "matrix"). We should probably make it work.
>
> Best,
>  John
>
> >
> > Thank you again,
> >
> > Antonio
> >
> > On Thu, Feb 22, 2018 at 3:51 PM, Fox, John <jfox at mcmaster.ca
> > <mailto:jfox at mcmaster.ca> > wrote:
> >
> >
> >       Dear Toni,
> >
> >       Yes, that looks reasonable, although I'm not sure why it's
> necessary to
> > test for more than one fixed-effect intercept at the beginning of the
> fixed-effect
> > coefficient vector and how an intercept could be named "Intercept"
> rather than
> > "(Intercept)". Assuming that there's a reason that escapes me, here's a
> simplified
> > version:
> >
> >       vif.lme <- function (fit) {
> >         ## adapted from rms::vif
> >         v <- vcov(fit)
> >         nam <- names(fixef(fit))
> >         ## exclude intercepts
> >         ns <- sum(nam == "Intercept" | nam == "(Intercept)")
> >         if (ns > 0) v <- v[-(1:ns), -(1:ns), drop = FALSE]
> >         diag(solve(cov2cor(v)))
> >       }
> >
> >       I hope this helps,
> >        John
> >
> >
> >       -----------------------------
> >       John Fox, Professor Emeritus
> >       McMaster University
> >       Hamilton, Ontario, Canada
> >       Web: socialsciences.mcmaster.ca/jfox/
> > <http://socialsciences.mcmaster.ca/jfox/>
> >
> >
> >
> >
> >       > -----Original Message-----
> >       > From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-
> > <mailto:r-sig-mixed-models-bounces at r->
> >       > project.org <http://project.org> ] On Behalf Of Toni Hernandez-
> > Matias
> >       > Sent: Thursday, February 22, 2018 7:28 AM
> >       > To: r-sig-mixed-models at r-project.org <mailto:
> r-sig-mixed-models at r-
> > project.org>
> >       > Subject: [R-sig-ME] 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
> >       >
> >       >
> >       > --
>

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

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
FAX: +34-934035740
e-mail: ahernandezmatias at ub.edu

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

	[[alternative HTML version deleted]]



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