par(mar = c(0, 0, 0, 0))
plot(NA, xlim = c(0, 13.2), ylim = c(0.2, 6.3), axes = FALSE, xlab = "", ylab = "")
box_at <- function(x, y, lab, col = "grey95", w = 1, h = 0.36) {
rect(x - w, y - h, x + w, y + h, col = col, border = "grey40", lwd = 1.5)
text(x, y, lab, cex = 1.25)
}
arr <- function(x0, y0, x1, y1) arrows(x0, y0, x1, y1, length = 0.1, lwd = 1.5, col = "grey30")
xs <- c(1.05, 3.6, 6.2, 8.8, 11.9) # data, response, selection, p-value, compare
ys <- c(5, 3.8, 2.6, 1.55, 0.6) # branches: observed, 1, 2, ..., m
text(xs, 6.15, c("data", "response", "selected predictor", "p-value of slope", "as extreme?"),
font = 2, cex = 1.15)
text(mean(xs[2:3]), 5.5, "max |cor|", cex = 1, col = "grey30")
text(mean(xs[3:4]), 5.5, "lm t-test", cex = 1, col = "grey30")
box_at(xs[1], 2.8, expression(atop(X ~ "fixed", (n %*% 20))), col = "lightyellow", h = 0.55)
resp <- list(quote(Y), quote(Y^(1)), quote(Y^(2)), NULL, quote(Y^(m)))
sel <- list(quote(X[k^"*"*(Y)]), quote(X[k^"*"*(Y^(1))]), quote(X[k^"*"*(Y^(2))]), NULL,
quote(X[k^"*"*(Y^(m))]))
pv <- list(quote(p^obs), quote(p^(1)), quote(p^(2)), NULL, quote(p^(m)))
cmp <- list(NULL, quote(I(p^(1) <= p^obs)), quote(I(p^(2) <= p^obs)), NULL, quote(I(p^(m) <= p^obs)))
for (b in c(1, 2, 3, 5)) {
fill <- if (b == 1) "lightblue" else "grey95"
arr(xs[1] + 1, 2.8, xs[2] - 1, ys[b])
box_at(xs[2], ys[b], as.expression(resp[[b]]), col = fill)
arr(xs[2] + 1, ys[b], xs[3] - 1, ys[b])
box_at(xs[3], ys[b], as.expression(sel[[b]]), col = fill)
arr(xs[3] + 1, ys[b], xs[4] - 1, ys[b])
box_at(xs[4], ys[b], as.expression(pv[[b]]), col = fill)
if (b > 1) {
arr(xs[4] + 1, ys[b], xs[5] - 1.2, ys[b])
box_at(xs[5], ys[b], as.expression(cmp[[b]]), col = "mistyrose", w = 1.2)
}
}
text(xs[2:5], ys[4] + 0.1, ":", cex = 2.2, font = 2)
text(1.05, 4.3, "observed", col = "steelblue", cex = 1.05)
text(1.05, 1.3, "permute Y", col = "grey30", cex = 1.05)