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.
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,
...
)(regression model)
Regression model object
Additional arguments passed to broom.helpers::tidy_plus_plus().
(formula-list-selector)
Used to change variables labels, e.g. list(age = "Age", stage = "Path T Stage")
(scalar logical)
Logical indicating whether to exponentiate the coefficient estimates.
Default is FALSE.
(tidy-select)
Variables to include in output. Default is everything().
(tidy-select)
By default categorical variables are printed on multiple rows.
If a variable is dichotomous (e.g. Yes/No) and you wish to print the
regression coefficient on a single row, include the variable name(s) here.
(scalar real)
Confidence level for confidence interval/credible interval. Defaults to 0.95.
(scalar logical)
Indicates whether to include the intercept in the output. Default is FALSE
(function)
Function to round and format coefficient estimates.
Default is label_style_sigfig() when the coefficients are not transformed, and
label_style_ratio() when the coefficients have been exponentiated.
(function)
Function to round and format p-values. Default is label_style_pvalue().
(function)
Tidier function for the model. Default is to use broom::tidy().
If an error occurs, the tidying of the model is attempted with
parameters::model_parameters(), if installed.
(scalar logical)
Add a reference value. Default is FALSE.
(scalar logical)
Logical indicating whether or not to include a confidence
interval in the output. Default is TRUE.
A tbl_regression object
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 original x= argument
is replaced with the model fit. This will typically go unnoticed; however,if you've
provided a custom tidier in tidy_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 tidier tidy_gam() to print both parametric and smooth terms.
"lmerMod", "glmerMod", "glmmTMB", "glmmadmb", "stanreg", "brmsfit": These mixed effects
models use broom.mixed::tidy(x, effects = "fixed"). Specify tidy_fun = broom.mixed::tidy
to print the random components.