About the describtion in car:: vif

Hi
I want to hear if anyone can explain this to me.. since it's really confused me and make me in doubt. It is taken from the vif function describtion from the car package

Specific methods are provided for ordinal regression model objects produced by polr in the MASS package and svyolr in the survey package, which are "intercept-less"; VIFs or GVIFs for linear and similar regression models without intercepts are generally not sensible.

Link to the describtion: vif {car}

What does it exactly mean? When I have a polr model and want to check vif can I use car::vif?

Yes.

library(car)
#> Loading required package: carData
library(MASS)
options(contrasts = c("contr.treatment", "contr.poly"))
house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
vif(house.plr)
#> 
#> Re-fitting to get Hessian
#>          GVIF Df GVIF^(1/(2*Df))
#> Infl 1.022042  2        1.005466
#> Type 1.035968  3        1.005907
#> Cont 1.043070  1        1.021308

Be aware, though, that polr is meant for ordered regression.

1 Like

Thanks for quick answer! Yes, and thats actually exactly what I want because I estimated an ordered logit and ordered probit using polr function from the MASS package, so I just wanted to be sure since I got very confused. Can we find out how exactly the vif for an polr is calculated?

The algorithm is discussed here. The code of the vif.polr implementation

vif.polr <- function(mod, ...) {
  if (any(is.na(coef(mod)))) 
    stop ("there are aliased coefficients in the model")
  v <- vcov(mod)
  nms <- names(coef(mod))
  v <- v[nms, nms]
  assign <- attr(model.matrix(mod), "assign")
  assign <- assign[assign != 0]
  terms <- labels(terms(mod))
  n.terms <- length(terms)
  if (n.terms < 2) stop("model contains fewer than 2 terms")
  R <- cov2cor(v)
  detR <- det(R)
  result <- matrix(0, n.terms, 3)
  rownames(result) <- terms
  colnames(result) <- c("GVIF", "Df", "GVIF^(1/(2*Df))")
  for (term in 1:n.terms) {
    subs <- which(assign == term)
    result[term, 1] <- det(as.matrix(R[subs, subs])) *
      det(as.matrix(R[-subs, -subs])) / detR
    result[term, 2] <- length(subs)
  }
  if (all(result[, 2] == 1)) result <- result[, 1]
  else result[, 3] <- result[, 1]^(1/(2 * result[, 2]))
  result
}
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.