Learn R Programming

gtsummary (version 1.6.3)

custom_tidiers: Collection of custom tidiers

Description

lifecycle::badge("maturing") Collection of tidiers that can be utilized in gtsummary. See details below.

Usage

tidy_standardize(
  x,
  exponentiate = FALSE,
  conf.level = 0.95,
  conf.int = TRUE,
  ...,
  quiet = FALSE
)

tidy_bootstrap( x, exponentiate = FALSE, conf.level = 0.95, conf.int = TRUE, ..., quiet = FALSE )

tidy_robust( x, exponentiate = FALSE, conf.level = 0.95, conf.int = TRUE, vcov = "HC", vcov_args = NULL, ..., quiet = FALSE )

pool_and_tidy_mice(x, pool.args = NULL, ..., quiet = FALSE)

tidy_gam(x, conf.int = FALSE, exponentiate = FALSE, conf.level = 0.95, ...)

tidy_wald_test(x, tidy_fun = NULL, ...)

Arguments

x

a regression model object

exponentiate

Logical indicating whether or not to exponentiate the the coefficient estimates. This is typical for logistic and multinomial regressions, but a bad idea if there is no log or logit link. Defaults to FALSE.

conf.level

The confidence level to use for the confidence interval if conf.int = TRUE. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.

conf.int

Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to FALSE.

...

arguments passed to method;

  • pool_and_tidy_mice(): mice::tidy(x, ...)

  • tidy_standardize(): parameters::standardize_parameters(x, ...)

  • tidy_bootstrap(): parameters::bootstrap_parameters(x, ...)

  • tidy_robust(): parameters::model_parameters(x, ...)

quiet

Logical indicating whether to print messages in console. Default is FALSE

vcov, vcov_args

arguments passed to parameters::model_parameters()

pool.args

named list of arguments passed to mice::pool() in pool_and_tidy_mice(). Default is NULL

tidy_fun

Option to specify a particular tidier function for the model. Default is to use broom::tidy(), but if an error occurs then tidying of the model is attempted with parameters::model_parameters(), if installed.

Regression Model Tidiers

These tidiers are passed to tbl_regression() and tbl_uvregression() to obtain modified results.

  • tidy_standardize() tidier to report standardized coefficients. The parameters package includes a wonderful function to estimate standardized coefficients. The tidier uses the output from parameters::standardize_parameters(), and merely takes the result and puts it in broom::tidy() format.

  • tidy_bootstrap() tidier to report bootstrapped coefficients. The parameters package includes a wonderful function to estimate bootstrapped coefficients. The tidier uses the output from parameters::bootstrap_parameters(test = "p"), and merely takes the result and puts it in broom::tidy() format.

  • tidy_robust() tidier to report robust standard errors, confidence intervals, and p-values. The parameters package includes a wonderful function to calculate robust standard errors, confidence intervals, and p-values The tidier uses the output from parameters::model_parameters(), and merely takes the result and puts it in broom::tidy() format. To use this function with tbl_regression(), pass a function with the arguments for tidy_robust() populated. This is easily done using purrr::partial() e.g. tbl_regression(tidy_fun = partial(tidy_robust, vcov = "CL"))

  • pool_and_tidy_mice() tidier to report models resulting from multiply imputed data using the mice package. Pass the mice model object before the model results have been pooled. See example.

Other Tidiers

  • tidy_wald_test() tidier to report Wald p-values, wrapping the aod::wald.test() function. Use this tidier with add_global_p(anova_fun = tidy_wald_test)

Example Output

Example 1

image of rendered example table

Example 2

image of rendered example table

Example 3

image of rendered example table