Skip to contents

Add the variance inflation factor (VIF) or generalized VIF (GVIF) to the regression table. Function uses car::vif() to calculate the VIF.

Usage

add_vif(x, statistic = NULL, estimate_fun = label_style_sigfig(digits = 2))

Arguments

x

'tbl_regression' object

statistic

"VIF" (variance inflation factors, for models with no categorical terms) or one of/combination of "GVIF" (generalized variance inflation factors), "aGVIF" 'adjusted GVIF, i.e. GVIF^[1/(2*df)] and/or "df" (degrees of freedom). See car::vif() for details.

estimate_fun

Default is label_style_sigfig(digits = 2).

See also

Review list, formula, and selector syntax used throughout gtsummary

Examples

# Example 1 ----------------------------------
lm(age ~ grade + marker, trial) |>
  tbl_regression() |>
  add_vif()
Characteristic Beta 95% CI1 p-value GVIF1 Adjusted GVIF2,1
Grade


1.0 1.0
    I


    II 0.64 -4.7, 6.0 0.8

    III 2.4 -2.8, 7.6 0.4

Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9 1.0 1.0
1 CI = Confidence Interval, GVIF = Generalized Variance Inflation Factor
2 GVIF^[1/(2*df)]
# Example 2 ---------------------------------- lm(age ~ grade + marker, trial) |> tbl_regression() |> add_vif(c("aGVIF", "df"))
Characteristic Beta 95% CI1 p-value Adjusted GVIF2,1 df1
Grade


1.0 2
    I


    II 0.64 -4.7, 6.0 0.8

    III 2.4 -2.8, 7.6 0.4

Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9 1.0 1
1 CI = Confidence Interval, GVIF = Generalized Variance Inflation Factor, df = degrees of freedom
2 GVIF^[1/(2*df)]