From 63114352b7eedfb97a8cddde674baac89cad1ec8 Mon Sep 17 00:00:00 2001 From: Chen Date: Wed, 28 Oct 2026 07:21:33 -0400 Subject: [PATCH] Report: bootstrap SE section (Table 6) Co-Authored-By: Claude Opus 5.5 --- reports/draft-report.Rmd | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/reports/draft-report.Rmd b/reports/draft-report.Rmd index f976c2c..95bc348 100644 --- a/reports/draft-report.Rmd +++ b/reports/draft-report.Rmd @@ -276,6 +276,28 @@ W5/WR bias. are near 1 for CCW (0.96–1.07, except WR 0.87). They are 0.83–0.92 for landmark and sequential trials in W0, and 0.58 for landmark in W1. +# 7. Standard errors: physician-cluster bootstrap check (D28, D53) + +```{r boot} +bf <- list.files(file.path(root, "results", "bootstrap"), pattern = "\\.csv$", full.names = TRUE) +if (length(bf)) { + bt <- rbindlist(lapply(bf, fread)) + mv <- reps[analysis == "main" & variant == "V1_ignore" & rep %in% unique(bt$rep), + .(world, scenario, rep, design, contrast, outcome, se_patient, se_cluster)] + bt <- merge(bt, mv, by = c("world", "scenario", "rep", "design", "contrast", "outcome")) + emp <- perf[analysis == "main" & variant == "V2_cluster", .(world, scenario, design, contrast, outcome, emp_se)] + x <- bt[, .(reps = .N, boot = sqrt(mean(boot_se^2)), patient = sqrt(mean(se_patient^2)), + cluster = sqrt(mean(se_cluster^2))), by = .(world, scenario, design, contrast, outcome)] + x <- merge(x, emp, by = c("world", "scenario", "design", "contrast", "outcome")) + x <- x[outcome == "disease" & contrast != "A_B2"] + knitr::kable(x[order(world, scenario, design), .(World = world, Scenario = scenario, Design = design, + `Empirical SE (100 reps)` = pp(emp_se, 2), `Bootstrap SE` = pp(boot, 2), `Model SE, cluster` = pp(cluster, 2), + `Model SE, patient` = pp(patient, 2), `Bootstrap / empirical` = round(boot / emp_se, 2), + `Cluster / empirical` = round(cluster / emp_se, 2))], + caption = "Table 6. Disease composite. Bootstrap: 50 physician-cluster resamples on each of replicates 1-20.") +} else cat("Bootstrap results not yet available.") +``` + # Supplement: full performance table ```{r supp}