Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

add_vif

Add Variance Inflation Factor


Description

[Experimental] 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 = 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

# 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"))
}

gtsummary

Presentation-Ready Data Summary and Analytic Result Tables

v1.4.0
MIT + file LICENSE
Authors
Daniel D. Sjoberg [aut, cre] (<https://orcid.org/0000-0003-0862-2018>), Michael Curry [aut] (<https://orcid.org/0000-0002-0261-4044>), Margie Hannum [aut] (<https://orcid.org/0000-0002-2953-0449>), Joseph Larmarange [aut] (<https://orcid.org/0000-0001-7097-700X>), Karissa Whiting [aut] (<https://orcid.org/0000-0002-4683-1868>), Emily C. Zabor [aut] (<https://orcid.org/0000-0002-1402-4498>), Esther Drill [ctb] (<https://orcid.org/0000-0002-3315-4538>), Jessica Flynn [ctb] (<https://orcid.org/0000-0001-8310-6684>), Jessica Lavery [ctb] (<https://orcid.org/0000-0002-2746-5647>), Stephanie Lobaugh [ctb], Gustavo Zapata Wainberg [ctb] (<https://orcid.org/0000-0002-2524-3637>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.