R/gt_univariate_stratified.R
tbl_cmh.RdA {gtsummary} wrapper function that takes a dataframe and produces crude, stratified and Cochran-Mantel-Haenszel estimates.
tbl_cmh(
data,
case,
exposure,
strata,
measure,
obstime = NULL,
conf.level = 0.95
)A data frame
Name of a variable as your outcome of interest
Names of variables as exposures of interest. Can be multiple variables using tidyselect syntax.
Name of a variable to be used for stratifying results. This gives you a table of crude measure, measures for each strata and the mantel-haeszel adjusted measure for each exposure variable
Specify what you would like to calculated, options are "OR", "RR" or "IRR". Default is "OR". If "OR or "RR" are specified then a woolf test for homogeneity p-value is produced. This tests whether there is a significant difference in the estimates between strata.
A numeric variable containing the observation time for each individual
Confidence level for confidence intervals (default 0.95)
A gtsummary table of class "tbl_cmh" (and "gtsummary", "tbl_stack")
containing:
Crude estimates of association (odds ratios, risk ratios, or rate ratios)
Stratified estimates for each level of the stratification variable
Cochran–Mantel–Haenszel (CMH) adjusted estimates with 95\
Woolf test p-values for assessing homogeneity across strata (when applicable)
Inspired by Daniel Sjoberg, see gtsummary github repo