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 inpredictors.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
Arguments
- m
(required, matrix) Correlation matrix generated via
stats::cor()orcor_matrix(). Must have named dimensions. Default: NULL- quiet
(optional; logical) If FALSE, messages are printed. Default: FALSE.
- ...
(optional) Internal args (e.g.
function_nameforvalidate_arg_function_name, a precomputed correlation matrixm, or cross-validation args forpreference_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
data(vi_smol, vi_predictors_numeric)
m <- cor_matrix(
df = vi_smol,
predictors = vi_predictors_numeric[1:5]
)
vif(m)
#> swi_mean swi_max topo_slope topo_diversity topo_elevation
#> 5.4512 5.0707 1.6719 1.5817 1.4120
