# Newman SC. Biostatistical methods in epidemiology. New York, NY:
# Wiley, 2001, table 5.3
library(tibble) # used to set up example data
dat <- tibble(
death = c(rep(1, 54), rep(0, 138)),
stage = c(rep("Stage I", 7), rep("Stage II", 26), rep("Stage III", 21),
rep("Stage I", 60), rep("Stage II", 70), rep("Stage III", 8)),
receptor = c(rep("Low", 2), rep("High", 5), rep("Low", 9), rep("High", 17),
rep("Low", 12), rep("High", 9), rep("Low", 10), rep("High", 50),
rep("Low", 13), rep("High", 57), rep("Low", 2), rep("High", 6)))
# Risk difference
rr_rd_mantel_haenszel(
data = dat,
exposure = stage,
outcome = death,
confounders = receptor,
estimand = "rd")
# Risk ratio, log scale:
result <- rr_rd_mantel_haenszel(
data = dat,
exposure = stage,
outcome = death,
confounders = receptor,
estimand = "rr")
result
# Risk ratio, exponentiated:
result %>%
dplyr::mutate(dplyr::across(.cols = c(estimate, conf.low, conf.high),
.fns = exp))
Run the code above in your browser using DataLab