Learn R Programming

collinear (version 3.0.0)

vif: Compute variance inflation factors from a correlation matrix

Description

Computes the Variance Inflation Factors from a correlation matrix in two steps:

  • Applies base::solve() to transform the correlation matrix into a precision matrix, which is the inverse of the covariance matrix between all variables in predictors.

  • Applies base::diag() to extract the diagonal of the precision matrix, which contains the variance of the regression of each predictor against all other predictors, also known as Variance Inflation Factor

Usage

vif(m = NULL, quiet = FALSE, ...)

Value

named numeric vector

Arguments

m

(required, matrix) Correlation matrix generated via stats::cor() or cor_matrix(). Must have named dimensions. Default: NULL

quiet

(optional; logical) If FALSE, messages are printed. Default: FALSE.

...

(optional) Internal args (e.g. function_name for validate_arg_function_name, a precomputed correlation matrix m, or cross-validation args for preference_order).

Variance Inflation Factors

VIF for predictor \(a\) is computed as \(1/(1-R^2)\), where \(R^2\) is the multiple R-squared from regressing \(a\) on the other predictors. Recommended maximums commonly used are 2.5, 5, and 10.

References

  • David A. Belsley, D.A., Kuh, E., Welsch, R.E. (1980). Regression Diagnostics: Identifying Influential Data and Sources of Collinearity. John Wiley & Sons. DOI: 10.1002/0471725153.

See Also

Other multicollinearity_assessment: collinear_stats(), cor_clusters(), cor_cramer(), cor_df(), cor_matrix(), cor_stats(), vif_df(), vif_stats()

Examples

Run this code
data(vi_smol, vi_predictors_numeric)

m <- cor_matrix(
  df = vi_smol,
  predictors = vi_predictors_numeric[1:5]
)

vif(m)

Run the code above in your browser using DataLab