-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathS3.Rmd
418 lines (341 loc) · 14.8 KB
/
S3.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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
---
title: "S3"
output:
html_document:
toc: true
toc_float:
smooth_scroll: FALSE
number_sections: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(dplyr)
library(gt)
library(Metrics)
library(pomp)
library(readr)
library(readsdr)
library(stringr)
library(tictoc)
library(tidyr)
source("./R_scripts/plots.R")
source("./R_scripts/optim_est.R")
pop_val <- 17475415
beta_vals <- 0.724637681 * c(1, 1.5, 2)
zeta_val <- beta_vals[[2]] * 10 # Contact rate
phi_val <- 0.65 # Vaccine effectiveness
tau_v_val <- 180 # Vaccine availability
iota_v_val <- 0.75 # Willingness to vaccinate
iota_d_val <- 0.51 # Willingness to isolate/quarantine
delta_val <- 0.6 # Willingness to take a test
par_tau_m <- 0 # Day at which mobility restrictions start
bio_df <- read_csv("./Data/bio_params.csv",
show_col_types = FALSE)
bio_params <- as.list(bio_df$Value)
names(bio_params) <- bio_df$Parameter
test_cap_pars <- read_csv("./Data/Testing_capacity_pars.csv",
show_col_types = FALSE) |>
tibble::deframe() |> as.list()
ct_cap_pars <- read_csv("./Data/Tracing_capacity_pars.csv",
show_col_types = FALSE) |>
tibble::deframe() |> as.list()
Qd_0 <- test_cap_pars$Qd
Qk_0 <- ct_cap_pars$Qk
Qm_0 <- 90
```
This electronic supplementary material supports the results presented in the
main text regarding vaccination and the comprehensive intervention.
Specifically, this HTML file is the rendered version of a dynamic document (R
markdown) containing the *R* code that simulates the models and produces the
plots shown in the main text. Additionally, this file includes supplementary
information to complement the discussion in the main text.
# Vaccination sub-model
## Equations
Compared to the SEI3R model (*1A_SEI3R.stmx*), the vaccination sub-model
(*3C_V.stmx*) modify the dynamics of disease transmission in the following way:
\begin{equation} \label{eq:4}
\begin{aligned}
\dot{S_t} &= -\lambda_t S_t - \psi_t S_t\\
\dot{S^h_t} &= -\lambda_t S^h_t \\
\dot{S^v_t} &= (1 - \phi)\psi_t S_t -\lambda_t S^v_t\\
\dot{E_t} &= \lambda_t (S_t + S^v_t) - \sigma E_t\\
\dot{R_t} &= \gamma I_t + \kappa A_t + \phi \psi_t S_t
\end{aligned}
\end{equation}
As with the *TTI* structure, we model vaccination capacity using the logistic
growth structure. Furthermore, considering that vaccines are not available at
the start of the pandemic, we introduce an if-else function to account for
this feature.
\begin{equation} \label{eq:5}
\begin{aligned}
\psi_t &= \frac{\min(S_t, f(Q^v_t, \tau^v))}{S_t} \\
f(Q_t, \tau) &= \begin{cases}
0, & \text{for } t < \tau \\
\frac{Q_t N}{1000}, & \text{for } t \geq \tau
\end{cases}\\
\dot{Q^v_t} &= \begin{cases}
0, & \text{for } t < \tau \\
\rho^v Q^v_t (1 - \frac{Q^v_t} {\alpha^v}), & \text{for } t \geq \tau
\end{cases}\\
\end{aligned}
\end{equation}
## Partial calibration
To configure the logistic structure in the vaccination sub-model, we use data
from the COVID-19 in the Netherlands and model calibration. This data indicates
that vaccination's initial capacity in Feb 2021 was 230.000 per week. From April
onwards, it was between 400.000-500.000 per week, and 6 weeks were needed to
scale up to 1.500.000 per week^[https://www.medicalfacts.nl/wp-content/uploads/2021/02/Presentatie_de_heer_Jaap_van_Delden_programmadirecteur_vaccinatie_COVID-19_bij_het_RIVM1.pdf].
```{r}
data_vacc <- data.frame(time = c(0, 60, 102),
value = 1000 * (c(230000, 400000, 1500000) / 7) / pop_val)
est_obj <- estimate_rho(data_vacc)
par_rho_v <- est_obj$estimate
Qv_0 <- data_vacc$value |> head(1)
par_alpha_v <- data_vacc$value |> tail(1)
```
```{r, fig.cap = "Fig 1. Vaccination capacity"}
plot_fit(est_obj$sim, data_vacc)
```
# Comprehensive intervention (TTI + MR + V)
All interventions are integrated into a single model (3B_TTI_PLUS_MR_PLUS_V.stmx).
## Validation
Before exploring the impact of a comprehensive approach, we verify that the
integrated model and intervention-specific models produce identical output under
equivalent configurations.
```{r}
fp_synthesis <- "./models/3B_TTI_PLUS_MR_PLUS_V.stmx"
mdl_sth <- read_xmile(fp_synthesis,
const_list = c(bio_params,
par_zeta_0 = zeta_val,
par_rho_v = par_rho_v,
par_alpha_v = par_alpha_v,
par_phi = phi_val,
par_iota_v = iota_v_val,
par_iota_d = iota_d_val,
par_delta = delta_val,
par_rho_d = test_cap_pars$rho_d,
par_alpha_d = test_cap_pars$alpha_d,
par_rho_k = ct_cap_pars$rho_k,
par_alpha_k = ct_cap_pars$alpha_k,
par_tau_m = par_tau_m,
par_tau_v = tau_v_val,
par_xi = 0.8),
stock_list = list(Qv = Qv_0,
Qd = test_cap_pars$Qd,
Qk = ct_cap_pars$Qk,
Qm = Qm_0))
```
```{r}
par_tau_v_test <- 0
# Scenarios data frame
# First scenario: No intervention
# Second scenario: Testing and Isolation (TI)
# Third scenario: Contact tracing (CT)
# Fourth scenario: Mobility restrictions (MR)
# Fifth scenario: Vaccination (V)
s_df <- data.frame(Qd = c(0, Qd_0, Qd_0, 0, 0),
Qk = c(0, 0, Qk_0, 0, 0),
Qm = c(0, 0, 0, Qm_0, 0),
Qv = c(0, 0, 0, 0, Qv_0),
iter = 1:5,
itv = c("Base case", "TI", "CT", "MR", "V"),
par_tau_v = par_tau_v_test)
sim_output_syn <- sd_sensitivity_run(mdl_sth$deSolve_components,
stocks_df = s_df |> select(-iter, - itv),
consts_df = s_df |> select(par_tau_v),
start_time = 0,
stop_time = 1000,
timestep = 1 / 32,
reporting_interval = 1/ 8,
multicore = TRUE, n_cores = 5) |>
select(time, iter, C_in, Qv, Qd, Qk, Qm) |>
mutate(model = "Synthesis") |>
left_join(s_df[, c("iter", "itv")])
```
```{r}
mdl_base <- read_xmile("./models/1A_SEI3R.stmx",
const_list = c(bio_params,
par_beta = beta_vals[[2]]))
temp <- sd_simulate(mdl_base$deSolve_components,
start_time = 0,
stop_time = 1000,
timestep = 1 / 32)
sim_output_b <- temp |> select(time, C_in) |>
mutate(itv = "Base case",
model = "Single intervention")
```
```{r}
mdl_test <- read_xmile("./models/2B_TI_Logistic.stmx",
stock_list = list(Qd = Qd_0),
const_list = c(bio_params,
par_beta = beta_vals[[2]],
par_alpha_d = test_cap_pars$alpha_d,
par_rho_d = test_cap_pars$rho_d,
par_iota_d = iota_d_val,
par_delta = delta_val))
sim_output_TI <- sd_simulate(mdl_test$deSolve_components,
start_time = 0,
stop_time = 1000,
timestep = 1 / 32) |>
select(time, C_in) |>
mutate(itv = "TI",
model = "Single intervention")
```
```{r}
fp_ct <- "./models/2C_TTI_Logistic.stmx"
mdl_ct <- read_xmile(fp_ct, stock_list = list(Qd = test_cap_pars$Qd,
Qk = ct_cap_pars$Qk),
const_list = c(bio_params,
par_zeta = beta_vals[[2]] * 10,
par_alpha_d = test_cap_pars$alpha_d,
par_alpha_k = ct_cap_pars$alpha_k,
par_rho_d = test_cap_pars$rho_d,
par_rho_k = ct_cap_pars$rho_k,
par_iota_d = iota_d_val,
par_delta = delta_val))
sim_output_CT <- sd_simulate(mdl_ct$deSolve_components,
start_time = 0,
stop_time = 1000,
timestep = 1 / 32) |>
select(time, C_in) |>
mutate(itv = "CT",
model = "Single intervention")
```
```{r}
fp_mob <- "./models/3C_MR.stmx"
mdl_mob <- read_xmile(fp_mob,
const_list = c(bio_params,
par_zeta_0 = beta_vals[[2]] * 10,
par_tau_m = 0),
stock_list = list(Qm = Qm_0))
sim_output_MR <- sd_simulate(mdl_mob$deSolve_components,
start_time = 0,
stop_time = 1000,
timestep = 1 / 32) |>
select(time, C_in) |>
mutate(itv = "MR",
model = "Single intervention")
```
```{r}
v_fp <- "./models/3A_V.stmx"
mdl_v <- read_xmile(v_fp,
const_list = c(bio_params,
par_beta = beta_vals[[2]],
par_rho_v = par_rho_v,
par_alpha_v = par_alpha_v,
par_phi = phi_val,
par_iota = iota_v_val,
par_tau_v = par_tau_v_test),
stock_list = list(Qv = Qv_0))
sim_output_v <- sd_simulate(mdl_v$deSolve_components,
start_time = 0,
stop_time = 1000,
timestep = 1 / 32) |>
select(time, C_in) |>
mutate(itv = "V",
model = "Single intervention")
```
```{r, warning = FALSE, fig.height = 8, fig.cap = "Fig 2. Validation"}
sgl_int <- bind_rows(sim_output_b, sim_output_TI, sim_output_CT, sim_output_MR,
sim_output_v)
df <- bind_rows(sim_output_syn, sgl_int) |>
mutate(itv = factor(itv, levels = c("Base case", "TI", "CT", "MR", "V"),
ordered = TRUE))
plot_output_comparison(df)
```
# Simulation
This code simulates the comprehensive intervention.
```{r}
sim_sth <- sd_simulate(mdl_sth$deSolve_components, start_time = 0,
stop_time = 365, timestep = 1/64,
integ_method = "euler") |>
filter(time %in% seq(0, 365, 1/8))
```
The code below performs a scenario analysis. In this analysis, we combine two
levels of vaccination willingness and capacity each, resulting in four
scenarios.
```{r}
iota_v_low <- 0.45
# It is assumed that one individual triggers the outbreak
S1 <- (pop_val - 1) * iota_v_val # High willingness
S2 <- (pop_val - 1) * iota_v_low # Low willingness
S_vals <- rep(c(S1, S2), each = 2)
Sh1 <- (pop_val - 1) * (1 - iota_v_val) # High willingness
Sh2 <- (pop_val - 1) * (1 - iota_v_low) # Low willingness
Sh_vals <- rep(c(Sh1, Sh2), each = 2)
# Vaccination scenarios
vacn_scn <- data.frame(Qv = rep(c(Qv_0, 12.26), 2),
S = S_vals,
Sh = Sh_vals,
par_rho_v = rep(c(par_rho_v, 0), 2),
par_alpha_v = rep(c(par_alpha_v, 12.26), 2),
cap_scn = rep(c("C1", "C2"), 2),
wln_scn = c("High", "High", "Low", "Low")) |>
mutate(iter = row_number())
```
```{r}
vacn_scn |> select(-iter) |>
mutate(across(where(is.numeric),~round(.x, 2)),
S = format(S, big.mark = " "),
Sh = format(Sh, big.mark = " ")) |>
gt() |>
cols_label(
par_alpha_v = html("α<sup>v</sup>"),
par_rho_v = html("ρ<sup>v</sup>"),
Qv = html("Q<sub>0</sub><sup>v</sup>"),
S = html("S<sub>0</sub>"),
Sh = html("S<sub>0</sub><sup>h</sup>"),
cap_scn = "Capacity scenario",
wln_scn = "Willingness scenario")
```
```{r}
sim_vacn_scn <- sd_sensitivity_run(mdl_sth$deSolve_components,
consts_df = dplyr::select(vacn_scn,
par_rho_v, par_alpha_v),
stocks_df = dplyr::select(vacn_scn, Qv, S, Sh),
start_time = 0,
stop_time = 365, timestep = 1/64,
integ_method = "euler",
multicore = TRUE, n_cores = 4) |>
filter(time %in% seq(0, 365, 1/8)) |>
left_join(select(vacn_scn, iter, cap_scn, wln_scn))
```
For comparison purposes, we recreate the base-case scenario...
```{r}
base_mdl <- read_xmile("./models/1A_SEI3R.stmx",
const_list = c(bio_params,
par_beta = beta_vals[[2]]))
base_sim <- sd_simulate(base_mdl$deSolve_components,
integ_method = "euler", start_time = 0,
stop_time = 365, timestep = 1 / 64) |>
filter(time %in% seq(0, 365, 1/8))
```
and the TTI + MR scenario.
```{r}
mdl_npi_fp <- "./models/2F_TTI_PLUS_MR.stmx"
mdl_npi <- read_xmile(mdl_npi_fp,
const_list = c(bio_params,
par_zeta_0 = zeta_val,
par_alpha_d = test_cap_pars$alpha_d,
par_alpha_k = ct_cap_pars$alpha_k,
par_rho_d = test_cap_pars$rho_d,
par_rho_k = ct_cap_pars$rho_k,
par_tau_m = par_tau_m,
par_xi = 0.8,
par_iota_d = iota_d_val,
par_delta = delta_val),
stock_list = list(
Qd = test_cap_pars$Qd,
Qk = ct_cap_pars$Qk,
Qm = 90))
sim_npi <- sd_simulate(mdl_npi$deSolve_components, start_time = 0,
stop_time = 365, timestep = 1/64,
integ_method = "euler") |>
filter(time %in% seq(0, 365, 1/8))
```
This code produces Fig 11 in the main text.
```{r, fig.height = 7}
g <- plot_fig_11(sim_sth, base_sim, sim_npi, sim_vacn_scn)
ggsave("./plots/Fig_11_Vaccination_sim.pdf", plot = g,
height = 7, width = 7, device = cairo_pdf)
```