# Define example data
library(broom) # provides tidy() function
dat <- tibble::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)))
# Fit and tidy the model
fit_rr <- riskratio(formula = death ~ stage + receptor, data = dat)
tidy(fit_rr)
# Marginal standardization,
# increase number of bootstrap repeats:
# \donttest{
fit_rr <- riskratio(
formula = death ~ stage + receptor, data = dat,
approach = "margstd_boot")
tidy(fit_rr, bootrepeats = 2000)
# }
# Multiple types of models fitted:
# \donttest{
fit_rr <- riskratio(formula = death ~ stage + receptor, data = dat,
approach = "all")
tidy(fit_rr)
# }
Run the code above in your browser using DataLab