| lav_vif | R Documentation |
Compute VIF for each predictor that appears in structural regressions with two or more predictors, refitting the necessary sub-models so that latent predictors are handled at the latent level (i.e., with their original measurement models). It returns also the R^2 of each eligible endogenous variable from the original fit for context.
lav_vif(
fit,
data = NULL,
quiet = TRUE
)
## S3 method for class 'lav_vif'
print(x, digits = 3, cutoff = c(5, 10), ...)
## S3 method for class 'lav_vif'
summary(object, ...)
fit |
A fitted |
data |
Optional. The data frame used to fit |
quiet |
Logical. If |
x |
A 'lav_vif' object. |
digits |
Integer number of digits to print. |
cutoff |
Numeric length-2 thresholds used to flag VIF values. |
... |
Passed to 'print.lav_vif()' (e.g., 'digits', 'cutoff'). |
object |
A 'lav_vif' object. |
Each auxiliary refitted model:
includes the original measurement model for any latent predictors;
includes any residual covariances among those indicators that were specified in the original model;
regresses the focal predictor on the remaining predictors at the latent level when applicable.
VIF_i = 1 / (1 - R^2_i) generalizes VIF to SEM while respecting measurement models.
The function reuses the estimator, missing-data handling, and several options
from fit.
A list with:
vif_table: data.frame with columns
outcome, predictor, group, r2_predictor,
vif, k_predictors.
outcome_r2: data.frame with R^2 per eligible endogenous
outcome and group from the original fit.
set.seed(42)
x1 <- rnorm(100); x2 <- 0.85*x1 + rnorm(100, sd = sqrt(1 - 0.85^2)); x3 <- rnorm(100)
y <- 0.5*x1 + 0.3*x2 + 0.1*x3 + rnorm(100, sd = 0.7)
dataset <- data.frame(y, x1, x2, x3)
fit <- lavaan::sem("y ~ x1 + x2 + x3", data = dataset)
lav_vif(
fit = fit,
data = dataset)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.