add_vif: Add Variance Inflation Factor

Description Usage Arguments Example Output Examples

View source: R/add_vif.R

Description

\lifecycle

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

Usage

1
add_vif(x, statistic = NULL, estimate_fun = NULL)

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 style_sigfig().

Example Output

Example 1

Example 2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Example 1 ----------------------------------
if (requireNamespace("car"))
  add_vif_ex1 <-
    lm(age ~ grade + marker, trial) %>%
    tbl_regression() %>%
    add_vif()

# Example 2 ----------------------------------
if (requireNamespace("car"))
  add_vif_ex2 <-
    lm(age ~ grade + marker, trial) %>%
    tbl_regression() %>%
    add_vif(c("aGVIF", "df"))

ddsjoberg/gtsummary documentation built on April 8, 2021, 5:48 a.m.