A {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
)

Arguments

data

A data frame

case

Name of a variable as your outcome of interest

exposure

Names of variables as exposures of interest. Can be multiple variables using tidyselect syntax.

strata

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

measure

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.

obstime

A numeric variable containing the observation time for each individual

conf.level

Confidence level for confidence intervals (default 0.95)

References

Inspired by Daniel Sjoberg, see gtsummary github repo