# Stratified win odds
res <- stratWO(x = KHCE, AVAL = "AVAL", TRTP = "TRTP",
STRATA = "STRATAN", ref = "P")
res
## Compare with the non-stratified win odds
res0 <- calcWO(AVAL ~ TRTP, data = KHCE, ref = "P")
res0
## Compare with the win odds in each stratum separately
l <- lapply(split(KHCE, KHCE$STRATAN), calcWO, AVAL = "AVAL", TRTP = "TRTP", ref = "P")
l <- do.call(rbind, l)
l <- l[, c("WO", "LCL", "UCL", "N")]
l$STRATA <- as.numeric(row.names(l))
plot(y = l$WO, x = l$STRATA, ylim = c(0.5, 2.5), log = "y", xlim = c(0, 6),
ylab = "Win Odds", xlab = "", xaxt = "n")
axis(1, at = 1:6, labels = c(paste0("STR = ", l$STRATA), "Stratified", "Non-stratified"))
arrows(l$STRATA, l$LCL, l$STRATA,
l$UCL, angle = 90, code = 3, length = 0.05, col = "darkgreen")
points(5, res$WO)
arrows(5, res$LCL, 5, res$UCL, angle = 90, code = 3,
length = 0.05, col = "darkblue")
abline(h = c(1, res$WO), col = "red", lty = 4)
points(6, res0$WO)
arrows(6, res0$LCL, 6, res0$UCL, angle = 90, code = 3,
length = 0.05, col = "darkred")
# Stratified and adjusted win odds
res <- stratWO(x = KHCE, AVAL = "AVAL", COVAR = "EGFRBL",
TRTP = "TRTP", STRATA = "STRATAN", ref = "P")
res
Run the code above in your browser using DataLab