VIF: Generalised Variance Inflation Factors

Description Usage Arguments Details Value References Examples

View source: R/stdEff-fun.R

Description

Calculate generalised variance inflation factors for terms in a fitted model(s) via the variance-covariance matrix of coefficients.

Usage

1
VIF(mod, data = NULL, env = NULL)

Arguments

mod

A fitted model object, or a list or nested list of such objects.

data

An optional dataset, used to first refit the model(s).

env

Environment in which to look for model data (if none supplied). Defaults to the formula() environment.

Details

VIF() calculates generalised variance inflation factors (GVIF) as described in Fox & Monette (1992), and also implemented in car::vif(). However, whereas vif() returns both GVIF and GVIF^(1/(2*Df)) values, VIF() simply returns the squared result of the latter measure, which equals the standard VIF for single-coefficient terms and is the equivalent measure for multi-coefficient terms (e.g. categorical or polynomial). Also, while vif() returns values per model term (i.e. predictor variable), VIF() returns values per coefficient, meaning that the same value will be returned per coefficient for multi-coefficient terms. Finally, NA is returned for any terms which could not be estimated in the model (e.g. aliased).

Value

A numeric vector of the VIFs, or an array, list of vectors/arrays, or nested list.

References

Fox, J. and Monette, G. (1992) Generalized Collinearity Diagnostics. Journal of the American Statistical Association, 87, 178-183. doi: 10/dm9wbw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Model with two correlated terms
m <- shipley.growth[[3]]
VIF(m)  # Date & DD somewhat correlated
VIF(update(m, . ~ . - DD))  # drop DD

# Model with different types of predictor (some multi-coefficient terms)
d <- data.frame(
  y = rnorm(100),
  x1 = rnorm(100),
  x2 = as.factor(rep(c("a", "b", "c", "d"), each = 25)),
  x3 = rep(1, 100)
)
m <- lm(y ~ poly(x1, 2) + x2 + x3, data = d)
VIF(m)

semEff documentation built on Oct. 12, 2021, 5:06 p.m.