forked from CoVPN/correlates_reporting_usgcove_archive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.Rmd
386 lines (308 loc) · 10.3 KB
/
report.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
---
header-includes:
- \usepackage{float}
output:
pdf_document: default
html_document: default
citation_package: natbib
number_sections: true
extra_dependencies: ["caption", "subcaption", "graphicx"]
toc: true
---
```{r, echo=FALSE, message=FALSE}
message("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ running cor_threshold report ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
setwd("/Users/larsvanderlaan/correlates_reporting_forks/correlates_reporting")
library(here)
library(dplyr)
print(here::here())
source(here::here( "_common.R"))
times <- intersect(c("Day57", "Day29"), times)
keys_short <- times
if(study_name=="ENSEMBLE" | study_name=="MockENSEMBLE") {
keys_short <- c(keys_short, "Day29start1")
}
keys <- c()
markers <- markers
markers <- unlist(sapply(times, function(v) grep(v, markers, value = T))) # Remove the baseline markers
for(assay in assays) {
keys <- c(keys, paste0(keys_short, assay))
}
key_to_markers <- markers
names(key_to_markers) <- markers
marker_to_time <- sapply(markers, function(v) {
times[stringr::str_detect(v, times)]
})
marker_to_assay <- sapply(markers, function(v) {
unname(assays[stringr::str_detect(v, assays)])
})
key_to_time <- sapply(keys, function(v) {
times[stringr::str_detect(v, times)]
})
key_to_assay <- sapply(keys, function(v) {
unname(assays[stringr::str_detect(v, assays)])
})
key_to_markers <- paste0(key_to_time, key_to_assay )
names(key_to_markers) <- keys
key_to_markers
key_to_short <- sapply(keys, function(v) {
tmp <- setdiff(keys_short, "Day29start1")
if(stringr::str_detect(v, "Day29start1")) {
return("Day29start1")
} else {
return(unname(tmp[stringr::str_detect(v, tmp)]))
}
})
```
# Univariate CoR: Nonparametric Threshold Modeling (>=s)
An extension of the unadjusted nonparametric threshold-searching approach
developed in @Donovan, the covariate-adjusted TMLE-based approach developed by
van der Laan, Zhang, Gilbert (submitted) is used to estimate the so-called
threshold-response function $E_X[ E[Y \mid S \geq s, X, A = 1] \mid A=1]$ for a
range of thresholds $s$.Here, $X$ is a set of baseline characteristics, $A=1$
represents the vaccine group, $S$ is the biomarker/immune-response/correlate of
interest, and $Y$ is the indicator of COVID disease before some time point
$t_f$. This parameter can be viewed as a causal/covariate-adjusted version of
the parameter $P(Y=1 \mid S \geq s, A=1)$. Intuitively, the threshold-response
at a given threshold is the expected probability of obtaining COVID disease if
one experiences a marker/immune-response value above that threshold. The
threshold-response function is estimated for each of the four Day 57 antibody
markers, in each case adjusting for the baseline covariates: baseline risk
score, high risk indicator, and underrepresented minority status. A restrictive but flexible specification of the Highly Adaptive Lasso estimator is used for the covariate adjustment. A
number of plots and tables are reported:
\begin{enumerate}
\item A plot and table with risk estimates and point-wise 95\% confidence intervals
\item A plot and table with risk estimates and simultaneous 95\% confidence bands
\item Monotone-corrected versions of 1 and 2.
\end{enumerate}
A reverse cumulative distribution function curve estimated by the IPW NPMLE of
the marker values is superimposed on the threshold-response plots and a dashed
red line is added to mark the threshold value after which no more events are
observed.
The blue dots on the plots represent the risk predictions at marker values where there was an observed COVID-19 case.
```{r, echo = F, include = F}
short_keys <- unique(key_to_short)
```
```{r, echo = F, include = F}
days <- c()
if(has57) {
days <- c(days, 59)
}
if(has29) {
days <- c(days, 29)
}
ci <- "pointwise"
above = TRUE
monotone <- FALSE
```
```{r, results="asis", echo = F }
for(key in short_keys){
countAfter1 <- FALSE
if(length(stringr::str_detect(key,"start"))>0) {
countAfter1 <- TRUE
}
day <- gsub("Day", "", key)
day <- gsub("start1", "", key)
title <- paste0("Plots and Tables with estimates and ", ci, " confidence intervals"," for Day ", day)
if(monotone) {
title <- paste0(title, " (monotone-corrected)")
}
if(countAfter1) {
title <- paste0(title, " (counting events after 1 day post dose)")
}
cat("##", title, "\n")
for(assay in assays) {
key <- paste0(short_keys, assay)
marker <- key_to_markers[key]
cat(key)
#res = knitr::knit_child(c(here::here('cor_threshold', 'sub_report.Rmd')), quiet = TRUE)
res <- ""
cat(res, sep = '\n')
cat("\\clearpage", sep = '\n')
}
}
monotone <- TRUE
for(key in short_keys){
countAfter1 <- FALSE
if(length(stringr::str_detect(key,"start"))>0) {
countAfter1 <- TRUE
}
day <- gsub("Day", "", key)
day <- gsub("start1", "", key)
title <- paste0("Plots and Tables with estimates and ", ci, " confidence intervals"," for Day ", day)
if(monotone) {
title <- paste0(title, " (monotone-corrected)")
}
if(countAfter1) {
title <- paste0(title, " (counting events after 1 day post dose)")
}
cat("##", title, "\n")
for(assay in assays) {
key <- paste0(short_keys, assay)
marker <- key_to_markers[key]
cat(key)
#res = knitr::knit_child(c(here::here('cor_threshold', 'sub_report.Rmd')), quiet = TRUE)
cat(res, sep = '\n')
cat("\\clearpage", sep = '\n')
}
}
```
```{r, echo = F , results = "asis", eval = F}
ci <- "simultaneous"
for(key in short_keys){
countAfter1 <- FALSE
if(length(stringr::str_detect(key,"start"))>0) {
countAfter1 <- TRUE
}
day <- gsub("Day", "", key)
day <- gsub("start1", "", key)
title <- paste0("Plots and Tables with estimates and ", ci, " confidence intervals"," for Day ", day)
if(monotone) {
title <- paste0(title, " (monotone-corrected)")
}
if(countAfter1) {
title <- paste0(title, " (counting events after 1 day post dose)")
}
cat("##", title, "\n")
for(assay in assays) {
key <- paste0(short_keys, assay)
marker <- key_to_markers[key]
res = knitr::knit_child(c(here::here('cor_threshold', 'sub_report.Rmd')), quiet = TRUE)
cat(res, sep = '\n')
cat("\\clearpage", sep = '\n')
}
}
monotone <- TRUE
for(key in short_keys){
countAfter1 <- FALSE
if(length(stringr::str_detect(key,"start"))>0) {
countAfter1 <- TRUE
}
day <- gsub("Day", "", key)
day <- gsub("start1", "", key)
title <- paste0("Plots and Tables with estimates and ", ci, " confidence intervals"," for Day ", day)
if(monotone) {
title <- paste0(title, " (monotone-corrected)")
}
if(countAfter1) {
title <- paste0(title, " (counting events after 1 day post dose)")
}
cat("##", title, "\n")
for(assay in assays) {
key <- paste0(short_keys, assay)
marker <- key_to_markers[key]
res = knitr::knit_child(c(here::here('cor_threshold', 'sub_report.Rmd')), quiet = TRUE)
cat(res, sep = '\n')
cat("\\clearpage", sep = '\n')
}
}
```
# Univariate CoR: Nonparametric Threshold Modeling (<=s)
The same methodology as the previous section is apply to estimate the "below" threshold-response function $E_WE[Y=1|A=1,X,S \leq s].$
```{r, echo = F, include = F, eval = F}
ci <- "pointwise"
above = FALSE
monotone <- FALSE
```
```{r, results="asis", echo = F, eval = F}
setwd("/Users/larsvanderlaan/correlates_reporting_forks/correlates_reporting")
for(key in short_keys){
countAfter1 <- FALSE
if(length(stringr::str_detect(key,"start"))>0) {
countAfter1 <- TRUE
}
day <- gsub("Day", "", key)
day <- gsub("start1", "", key)
title <- paste0("Plots and Tables with estimates and ", ci, " confidence intervals"," for Day ", day)
if(monotone) {
title <- paste0(title, " (monotone-corrected)")
}
if(countAfter1) {
title <- paste0(title, " (counting events after 1 day post dose)")
}
cat("##", title, "\n")
for(assay in assays) {
key <- paste0(short_keys, assay)
marker <- key_to_markers[key]
res = knitr::knit_child(c(here::here('cor_threshold', 'sub_report.Rmd')), quiet = TRUE)
cat(res, sep = '\n')
cat("\\clearpage", sep = '\n')
}
}
monotone <- TRUE
for(key in short_keys){
countAfter1 <- FALSE
if(length(stringr::str_detect(key,"start"))>0) {
countAfter1 <- TRUE
}
day <- gsub("Day", "", key)
day <- gsub("start1", "", key)
title <- paste0("Plots and Tables with estimates and ", ci, " confidence intervals"," for Day ", day)
if(monotone) {
title <- paste0(title, " (monotone-corrected)")
}
if(countAfter1) {
title <- paste0(title, " (counting events after 1 day post dose)")
}
cat("##", title, "\n")
for(assay in assays) {
key <- paste0(short_keys, assay)
marker <- key_to_markers[key]
res = knitr::knit_child(c(here::here('cor_threshold', 'sub_report.Rmd')), quiet = TRUE)
cat(res, sep = '\n')
cat("\\clearpage", sep = '\n')
}
}
```
```{r, echo = F , results = "asis", eval = F}
ci <- "simultaneous"
for(key in short_keys){
countAfter1 <- FALSE
if(length(stringr::str_detect(key,"start"))>0) {
countAfter1 <- TRUE
}
day <- gsub("Day", "", key)
day <- gsub("start1", "", key)
title <- paste0("Plots and Tables with estimates and ", ci, " confidence intervals"," for Day ", day)
if(monotone) {
title <- paste0(title, " (monotone-corrected)")
}
if(countAfter1) {
title <- paste0(title, " (counting events after 1 day post dose)")
}
cat("##", title, "\n")
for(assay in assays) {
key <- paste0(short_keys, assay)
marker <- key_to_markers[key]
res = knitr::knit_child(c(here::here('cor_threshold', 'sub_report.Rmd')), quiet = TRUE)
cat(res, sep = '\n')
cat("\\clearpage", sep = '\n')
}
}
monotone <- TRUE
for(key in short_keys){
countAfter1 <- FALSE
if(length(stringr::str_detect(key,"start"))>0) {
countAfter1 <- TRUE
}
day <- gsub("Day", "", key)
day <- gsub("start1", "", key)
title <- paste0("Plots and Tables with estimates and ", ci, " confidence intervals"," for Day ", day)
if(monotone) {
title <- paste0(title, " (monotone-corrected)")
}
if(countAfter1) {
title <- paste0(title, " (counting events after 1 day post dose)")
}
cat("##", title, "\n")
for(assay in assays) {
key <- paste0(short_keys, assay)
marker <- key_to_markers[key]
res = knitr::knit_child(c(here::here('cor_threshold', 'sub_report.Rmd')), quiet = TRUE)
cat(res, sep = '\n')
cat("\\clearpage", sep = '\n')
}
}
```