D53: landmark on baseline covariates (month-5 version as landmark_m5), NCO-1 depends on PVI-free severity, physician-cluster bootstrap script

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-28 07:20:32 -04:00
co-authored by Claude Opus 5.5
parent fbc417662c
commit 5304c89316
10 changed files with 86 additions and 18 deletions
+3 -3
View File
@@ -4,7 +4,7 @@
suppressPackageStartupMessages(library(data.table))
a <- commandArgs(TRUE)
indir <- if (length(a) >= 1) a[1] else "results/main/n50k"
indir <- if (length(a) >= 1) a[1] else "results/main/n50k_v2"
outdir <- "results/summary"
dir.create(outdir, recursive = TRUE, showWarnings = FALSE)
@@ -32,7 +32,7 @@ d <- merge(d, tr[estimand == "rd_A_B1", .(world, scenario, outcome, ref = truth)
# landmark and naive: own estimand = the paired oracle estimate in the same replicate (D47)
orc <- d[variant == "oracle", .(world, scenario, rep, design, outcome, oracle = est)]
d <- merge(d, orc, by = c("world", "scenario", "rep", "design", "outcome"), all.x = TRUE)
d[design %in% c("landmark", "naive") & variant != "oracle", own := oracle]
d[design %in% c("landmark", "landmark_m5", "naive") & variant != "oracle", own := oracle]
d[analysis %like% "^nce", `:=`(own = 0, ref = 0)]
d[, oracle := NULL]
d[, `:=`(lo = est - 1.96 * se, hi = est + 1.96 * se)]
@@ -59,7 +59,7 @@ fwrite(perf, file.path(outdir, "perf.csv"))
# ---- negative controls as bias detectors (plan 10) ------------------------------------
# One unit = world x scenario x design x variant x replicate. Bias is in the MALE RD
# against the method's own estimand; a control "flags" when its 95% CI excludes 0.
m <- d[analysis == "main" & variant %in% c("V1_ignore", "V2_cluster", "V3_random", "V4_within") &
m <- d[analysis == "main" & design != "landmark_m5" & variant %in% c("V1_ignore", "V2_cluster", "V3_random", "V4_within") &
contrast %in% c("early_none", "A_B1", "now_not")]
u <- c("world", "scenario", "design", "variant", "rep")
flag <- function(x) x$lo > 0 | x$hi < 0