Calculates the relative risk which is defined as the ratio between the response rates between the experimental treatment group and the control treatment group, adjusted for stratification factors by applying Cochran-Mantel-Haenszel (CMH) weights.
Arguments
- tbl
(
array)
a 2 by 2 by number of strata contingency table, as returned in thetblelement oftern::h_prepare_rsp_table(). Rows (first dimension) are reference then treatment; columns (second dimension) are responders then nonresponders; the third dimension represents the strata.- conf_level
(
proportion)
confidence level of the interval.
Examples
set.seed(2)
rsp <- factor(
sample(c(TRUE, FALSE), 100, TRUE),
levels = c(TRUE, FALSE)
)
grp <- sample(c("Placebo", "Treatment"), 100, TRUE)
grp <- factor(grp, levels = c("Placebo", "Treatment"))
strata_data <- data.frame(
"f1" = sample(c("a", "b"), 100, TRUE),
"f2" = sample(c("x", "y", "z"), 100, TRUE),
stringsAsFactors = TRUE
)
tbl <- table(grp, rsp, interaction(strata_data))
prop_ratio_cmh(
tbl = tbl,
conf_level = 0.90
)
#> $rel_risk_ci
#> est lcl ucl
#> 0.7417303 0.4907583 1.1210485
#>
#> $pval
#> [1] 0.1892073
#>
