-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaltimore_20200413.R
209 lines (171 loc) · 9.12 KB
/
Baltimore_20200413.R
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
## Setup ####
require(socialmixr)
require(magrittr)
require(stringr)
require(reshape2)
require(dplyr)
require(ggplot2)
require(truncnorm)
source("asyptomatic_age.R")
age.limits <- c(0,5,10,15,20,25,35,45,55,60,65,75,85,90)
prop_symptomatic <- c(0.141, 0.106, 0.074, 0.184, 0.293, 0.387, 0.438,
0.535, 0.693, 0.816, 0.765, 0.749, 0.535, 0.535)
delta.t <- 1/1
time <- seq(1,300,by = delta.t)
t_March13 <- as.numeric(as.Date("2020-03-13") - as.Date("2020-03-01"))
t_March30 <- as.numeric(as.Date("2020-03-30") - as.Date("2020-03-01"))
t_April13 <- as.numeric(as.Date("2020-04-13") - as.Date("2020-03-01"))
t_April27 <- as.numeric(as.Date("2020-04-27") - as.Date("2020-03-01"))
t_May11 <- as.numeric(as.Date("2020-05-11") - as.Date("2020-03-01"))
t_May25 <- as.numeric(as.Date("2020-05-25") - as.Date("2020-03-01"))
t_June15 <- as.numeric(as.Date("2020-06-15") - as.Date("2020-03-01"))
t_July1 <- as.numeric(as.Date("2020-07-01") - as.Date("2020-03-01"))
nsim <- 1000
start_index <- seq(1, nsim*length(time)+1, by = length(time))
all_prelim_info <- setup_seir_model(stoch = TRUE,
R0 = 2,
c_scale_vec = 1,
prop_symptomatic = prop_symptomatic,
sd.dw = 0.1,
healthcare_n = 26890)
Ncomp = all_prelim_info$Ncomp
ICs = all_prelim_info$ICs
params = list(C = all_prelim_info$C,
W = all_prelim_info$W,
beta0 = all_prelim_info$beta0,
beta1 = all_prelim_info$beta1,
phase = all_prelim_info$phase,
mu = all_prelim_info$mu,
v = all_prelim_info$v,
N=all_prelim_info$N,
gamma=all_prelim_info$gamma,
sigma = all_prelim_info$sigma,
prop_symptomatic=all_prelim_info$prop_symptomatic,
sd.dw = all_prelim_info$sd.dw)
cnames.allsim <- c('run_index', 'time',
paste0("S", 1:Ncomp),
paste0("E", 1:Ncomp),
paste0("A", 1:Ncomp),
paste0("I", 1:Ncomp),
paste0("R", 1:Ncomp),
paste0("incid_A", 1:Ncomp),
paste0("incid_I", 1:Ncomp),
"R0",
"Reff")
## ---- Scenario A. Moderate Social Distancing with Constant Effectiveness: ---- ####
## This scenario has mildly restrictive social distancing from March 13-29, similar
## to that observed during the 1918 influenza pandemic (44-65% reduction in transmission),
## followed by a statewide stay-at-home policy from March 30 - July 1 where individuals
## remain socially distanced with constant effectiveness at a level similar to London’s
## current lockdown for three months (71-83% reduction in transmission).
all_sim <- matrix(NA,1,(Ncomp*7)+4)
colnames(all_sim) <- cnames.allsim
for(n in 1:nsim){
R0vec <- rep(runif(1, min = 2, max = 3), length(time))
c_scale_mat <- matrix(1, nrow = length(time), ncol=Ncomp)
eff1 <- runif(1, 0.44, 0.65)
c_scale_mat[t_March13:(t_March30-1), 1:(Ncomp-2)] <- (1-eff1)
eff2 <- runif(1, 0.658, 0.858) # MD model uses uniform draws for all effectiveness params
c_scale_mat[t_March30:t_July1, 1:(Ncomp-2)] <- (1-eff2)
tmp <- sair_step_variableR0(stoch = TRUE, stoch.init = TRUE,
R0vec = R0vec, Ncomp = Ncomp,
ICs = ICs, params = params,
time = time, delta.t = delta.t,
c_scale_mat = c_scale_mat)
run_index = rep(n, nrow(tmp))
tmp <- cbind(run_index, tmp)
all_sim <- rbind(all_sim, tmp)
}
all_sim <- all_sim[-1,]
write.csv(all_sim, file="output_20200413/scenarioA_moderate.csv")
## ---- Scenario B. Moderate Social Distancing with Degrading Effectiveness --- ####
## This scenario has mildly restrictive social distancing from March 13-29,
## similar to that observed during the 1918 influenza pandemic, followed by
## a statewide stay-at-home policy from March 30 - July 1, similar to that in
## effect in London, UK. During this stay-at-home period, the effectiveness
## of social distancing decays by 10% every 2 weeks.
all_sim <- matrix(NA,1,(Ncomp*7)+4)
colnames(all_sim) <- cnames.allsim
for(n in 1:nsim){
R0vec <- rep(runif(1, min = 2, max = 3), length(time))
c_scale_mat <- matrix(1, nrow = length(time), ncol=Ncomp)
eff1 <- runif(1, 0.44, 0.65)
c_scale_mat[t_March13:(t_March30-1), 1:(Ncomp-2)] <- (1-eff1)
eff2 <- rtruncnorm(1, a = 0.658, b = 0.858, mean = 0.7615, sd=0.2)
c_scale_mat[t_March30:(t_April13-1), 1:(Ncomp-2)] <- 1-eff2
c_scale_mat[t_April13:(t_April27-1), 1:(Ncomp-2)] <- 1-eff2*0.9
c_scale_mat[t_April27:(t_May11-1), 1:(Ncomp-2)] <- 1-eff2*0.8 #this is how the MD model was run - not successive 10% reductions
c_scale_mat[t_May11:(t_May25-1), 1:(Ncomp-2)] <- 1-eff2*0.7
c_scale_mat[t_May25:(t_June15-1), 1:(Ncomp-2)] <- 1-eff2*0.6
c_scale_mat[t_June15:t_July1, 1:(Ncomp-2)] <- 1-eff2*0.5
tmp <- sair_step_variableR0(stoch = TRUE, stoch.init = TRUE,
R0vec = R0vec, Ncomp = Ncomp,
ICs = ICs, params = params,
time = time, delta.t = delta.t,
c_scale_mat = c_scale_mat)
run_index = rep(n, nrow(tmp))
tmp <- cbind(run_index, tmp)
all_sim <- rbind(all_sim, tmp)
}
all_sim <- all_sim[-1,]
write.csv(all_sim, file="output_20200413/scenarioB_mod_degrading.csv")
## ---- Scenario C. Moderate Social Distancing Maintained when Schools Re-open April 27. ---- ####
## This scenario has mildly restrictive social distancing from March 13-29,
## similar to that observed during the 1918 influenza pandemic, followed by
## a statewide stay-at-home policy from March 30 - July 1, similar to that in
## effect in London, UK. The effectiveness of social distancing decays by 10%
## every 2 weeks and is further reduced 18% when Maryland schools are open from
## April 27 - June 15.
all_sim <- matrix(NA,1,(Ncomp*7)+4)
colnames(all_sim) <- cnames.allsim
for(n in 1:nsim){
R0vec <- rep(runif(1, min = 2, max = 3), length(time))
c_scale_mat <- matrix(1, nrow = length(time), ncol=Ncomp)
eff1 <- runif(1, 0.44, 0.65)
c_scale_mat[t_March13:(t_March30-1), 1:(Ncomp-2)] <- (1-eff1)
eff2 <- rtruncnorm(1, a = 0.658, b = 0.858, mean = 0.7615, sd=0.2)
c_scale_mat[t_March30:(t_April13-1), 1:(Ncomp-2)] <- 1-eff2
c_scale_mat[t_April13:(t_April27-1), 1:(Ncomp-2)] <- 1-eff2*0.9
c_scale_mat[t_April27:(t_May11-1), 1:(Ncomp-2)] <- 1- (eff2*0.8 - 0.18) # school closures were constant, absolute 18% decrease in effectiveness
c_scale_mat[t_May11:(t_May25-1), 1:(Ncomp-2)] <- 1- (eff2*0.7 - 0.18)
c_scale_mat[t_May25:(t_June15-1), 1:(Ncomp-2)] <- 1- (eff2*0.6 - 0.18)
c_scale_mat[t_June15:t_July1, 1:(Ncomp-2)] <- 1-eff2*0.5
tmp <- sair_step_variableR0(stoch = TRUE, stoch.init = TRUE,
R0vec = R0vec, Ncomp = Ncomp,
ICs = ICs, params = params,
time = time, delta.t = delta.t,
c_scale_mat = c_scale_mat)
run_index = rep(n, nrow(tmp))
tmp <- cbind(run_index, tmp)
all_sim <- rbind(all_sim, tmp)
}
all_sim <- all_sim[-1,]
write.csv(all_sim, file="output_20200413/scenarioC_mod_degrading_scl.csv")
## ---- Scenario D. All restrictions lifted April 27 --- ####
## This scenario has mildly restrictive social distancing from March 13-29,
## similar to that observed during the 1918 influenza pandemic, followed by
## a statewide stay-at-home policy from March 30 - April 27, similar to that
## in effect in London, UK. After April 28, Maryland schools reopen and all
## interventions are lifted. During the stay-at-home period, the effectiveness
## of social distancing decays by 10% every 2 weeks.
all_sim <- matrix(NA,1,(Ncomp*7)+4)
colnames(all_sim) <- cnames.allsim
for(n in 1:nsim){
R0vec <- rep(runif(1, min = 2, max = 3), length(time))
c_scale_mat <- matrix(1, nrow = length(time), ncol=Ncomp)
eff1 <- runif(1, 0.44, 0.65)
c_scale_mat[t_March13:(t_March30-1), 1:(Ncomp-2)] <- (1-eff1)
eff2 <- rtruncnorm(1, a = 0.658, b = 0.858, mean = 0.7615, sd=0.2)
c_scale_mat[t_March30:(t_April13-1), 1:(Ncomp-2)] <- 1-eff2
c_scale_mat[t_April13:(t_April27-1), 1:(Ncomp-2)] <- 1-eff2*0.9
tmp <- sair_step_variableR0(stoch = TRUE, stoch.init = TRUE,
R0vec = R0vec, Ncomp = Ncomp,
ICs = ICs, params = params,
time = time, delta.t = delta.t,
c_scale_mat = c_scale_mat)
run_index = rep(n, nrow(tmp))
tmp <- cbind(run_index, tmp)
all_sim <- rbind(all_sim, tmp)
}
all_sim <- all_sim[-1,]
write.csv(all_sim, file="output_20200413/scenarioD_total_reopen.csv")