col_set <- c(all = "#1f3b73", region = "#c4661f")
op <- par(mfrow = c(1, 2), mar = c(4.2, 4.2, 2.6, 5.4), mgp = c(2.4, 0.7, 0), las = 1)
# (a) each set's hazard ratio over follow-up
plot(NA, xlim = c(0, 120), ylim = c(0.55, 1.32), log = "y", xaxs = "i",
xlab = "months of follow-up (S2's clock)", ylab = "hazard ratio, experimental / control",
main = "(a) the sets' hazard ratio over follow-up", font.main = 1)
rect(0, 0.5, 29, 1.4, col = "grey88", border = NA); rect(29, 0.5, 40, 1.4, col = "grey94", border = NA)
abline(h = 1, col = "grey50", lty = 3)
for (s in names(prof)) {
lines(months, prof[[s]], col = col_set[[s]], lwd = 2)
segments(0, ck(s, 3, "margHR40"), 40, ck(s, 3, "margHR40"), col = col_set[[s]], lty = 2, lwd = 1.5)
}
y_bar <- c(1.28, 1.21, 1.14)
segments(0, y_bar, reach, y_bar, lwd = 2.5, col = "grey25")
text(reach, y_bar, c("x1 (ACTG 175)", "x3 (S2)", "x9"), pos = 4, cex = 0.8)
legend("bottomright", c("all patients", "region"), col = col_set, lwd = 2, bty = "n", cex = 0.85)
box()
# (b) margHR(40) against the hazard multiplier
plot(NA, xlim = range(clock$M), ylim = c(0.55, 1.32), log = "xy", xaxt = "n",
xlab = "hazard multiplier (x ACTG 175's hazards)", ylab = "hazard ratio",
main = "(b) margHR(40) as the multiplier changes", font.main = 1)
axis(1, at = 3^(-3:4), labels = c("1/27", "1/9", "1/3", "1", "3", "9", "27", "81"))
abline(v = c(1, 3, 9), col = "grey80"); abline(h = 1, col = "grey50", lty = 3)
for (s in c("all", "region")) {
d <- clock[clock$set == s, ]
abline(h = d$CDE[1], col = col_set[[s]], lty = 2)
abline(h = d$margHRinf[1], col = col_set[[s]], lty = 3, lwd = 1.5)
axis(4, at = d$AHR[1], labels = FALSE, col.ticks = col_set[[s]], lwd.ticks = 2, tcl = 1.2)
lines(d$M, d$margHR40, col = col_set[[s]], lwd = 2)
keep <- d$M %in% c(1, 3, 9)
points(d$M[keep], d$margHR40[keep], pch = 19, col = col_set[[s]])
}
mtext(c("CDE", expression("margHR(" * infinity * ")"), "AHR"), side = 4, line = 0.5, las = 1,
cex = 0.75,
at = c(ck("all", 3, "CDE"), ck("all", 3, "margHRinf"), mean(c(ck("all", 3, "AHR"), ck("region", 3, "AHR")))))
par(op)