tbl_regression {gtsummary} | R Documentation |
Regression model summary
Description
This function takes a regression model object and returns a formatted table
that is publication-ready. The function is customizable
allowing the user to create bespoke regression model summary tables.
Review the
tbl_regression()
vignette
for detailed examples.
Usage
tbl_regression(x, ...)
## Default S3 method:
tbl_regression(
x,
label = NULL,
exponentiate = FALSE,
include = everything(),
show_single_row = NULL,
conf.level = 0.95,
intercept = FALSE,
estimate_fun = ifelse(exponentiate, label_style_ratio(), label_style_sigfig()),
pvalue_fun = label_style_pvalue(digits = 1),
tidy_fun = broom.helpers::tidy_with_broom_or_parameters,
add_estimate_to_reference_rows = FALSE,
conf.int = TRUE,
...
)
Arguments
x |
(regression model) |
... |
Additional arguments passed to |
label |
( |
exponentiate |
(scalar |
include |
( |
show_single_row |
( |
conf.level |
(scalar |
intercept |
(scalar |
estimate_fun |
( |
pvalue_fun |
( |
tidy_fun |
( |
add_estimate_to_reference_rows |
(scalar |
conf.int |
(scalar |
Value
A tbl_regression
object
Methods
The default method for tbl_regression()
model summary uses broom::tidy(x)
to perform the initial tidying of the model object. There are, however,
a few models that use modifications.
-
"parsnip/workflows"
: If the model was prepared using parsnip/workflows, the original model fit is extracted and the originalx=
argument is replaced with the model fit. This will typically go unnoticed; however,if you've provided a custom tidier intidy_fun=
the tidier will be applied to the model fit object and not the parsnip/workflows object. -
"survreg"
: The scale parameter is removed,broom::tidy(x) %>% dplyr::filter(term != "Log(scale)")
-
"multinom"
: This multinomial outcome is complex, with one line per covariate per outcome (less the reference group) -
"gam"
: Uses the internal tidiertidy_gam()
to print both parametric and smooth terms. -
"lmerMod"
,"glmerMod"
,"glmmTMB"
,"glmmadmb"
,"stanreg"
,"brmsfit"
: These mixed effects models usebroom.mixed::tidy(x, effects = "fixed")
. Specifytidy_fun = broom.mixed::tidy
to print the random components.
Author(s)
Daniel D. Sjoberg
Examples
# Example 1 ----------------------------------
glm(response ~ age + grade, trial, family = binomial()) |>
tbl_regression(exponentiate = TRUE)