View source: R/tbl_regression.R
tbl_regression | R Documentation |
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,
...
)
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 |
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.
Daniel D. Sjoberg
# Example 1 ----------------------------------
glm(response ~ age + grade, trial, family = binomial()) |>
tbl_regression(exponentiate = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.