lav_vif: Variance Inflation Factors for 'lavaan' Structural Predictors

View source: R/lav_vif.R

lav_vifR Documentation

Variance Inflation Factors for 'lavaan' Structural Predictors

Description

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.

Usage

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, ...)

Arguments

fit

A fitted lavaan object.

data

Optional. The data frame used to fit fit. If NULL, the function attempts to extract the data from fit via lavInspect(fit, "data") then "data.original".

quiet

Logical. If TRUE suppresses lavaan refit messages.

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.

Details

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.

Value

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.

Examples

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)


lavinteract documentation built on Feb. 12, 2026, 5:10 p.m.