Skip to content

Commit d3f8233

Browse files
committed
remove intervention outputs + add namespace
1 parent a14e5af commit d3f8233

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

episodes/modelling-interventions.Rmd

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ recovery_rate <- 1.0 / infectious_period
118118
transmission_rate <- basic_reproduction * recovery_rate
119119
120120
# run baseline simulation with no intervention
121-
output_baseline <- model_default(
121+
output_baseline <- epidemics::model_default(
122122
population = uk_population,
123123
transmission_rate = transmission_rate,
124124
infectiousness_rate = infectiousness_rate,
@@ -144,15 +144,13 @@ rownames(cm_matrix)
144144
Therefore, we specify ` reduction = matrix(c(0.5, 0.01, 0.01))`. We assume that the school closures start on day 50 and continue to be in place for a further 100 days. Therefore our intervention object is:
145145

146146
```{r intervention}
147-
close_schools <- intervention(
147+
close_schools <- epidemics::intervention(
148148
name = "School closure",
149149
type = "contacts",
150150
time_begin = 50,
151151
time_end = 50 + 100,
152152
reduction = matrix(c(0.5, 0.01, 0.01))
153153
)
154-
155-
close_schools
156154
```
157155

158156
::::::::::::::::::::::::::::::::::::: callout
@@ -183,7 +181,7 @@ The contacts within group 1 are reduced by 50% twice to accommodate for a 50% re
183181
We run the model with ` intervention = list(contacts = close_schools)` as follows:
184182

185183
```{r school}
186-
output_school <- model_default(
184+
output_school <- epidemics::model_default(
187185
# population
188186
population = uk_population,
189187
# rate
@@ -204,7 +202,7 @@ To observe the effect of our intervention, we will combine the baseline and inte
204202
# create intervention_type column for plotting
205203
output_school$intervention_type <- "school closure"
206204
output_baseline$intervention_type <- "baseline"
207-
output <- rbind(output_school, output_baseline)
205+
output <- base::rbind(output_school, output_baseline)
208206
209207
output %>%
210208
filter(compartment == "infectious") %>%
@@ -250,21 +248,19 @@ We expect that mask wearing will reduce an individual's infectiousness, based on
250248
We create an intervention object with `type = rate` and `reduction = 0.161`. Using parameters adapted from [Li et al. 2020](https://doi.org/10.1371/journal.pone.0237691) we have proportion wearing masks = coverage $\times$ availability = $0.54 \times 0.525 = 0.2835$ and proportion reduction in transmission rate = $0.575$. Therefore, $\theta = 0.2835 \times 0.575 = 0.163$. We assume that the mask wearing mandate starts at day 40 and continue to be in place for 200 days.
251249

252250
```{r masks}
253-
mask_mandate <- intervention(
251+
mask_mandate <- epidemics::intervention(
254252
name = "mask mandate",
255253
type = "rate",
256254
time_begin = 40,
257255
time_end = 40 + 200,
258256
reduction = 0.163
259257
)
260-
261-
mask_mandate
262258
```
263259

264260
To implement this intervention on the transmission rate $\beta$, we specify `intervention = list(transmission_rate = mask_mandate)`.
265261

266262
```{r output_masks}
267-
output_masks <- model_default(
263+
output_masks <- epidemics::model_default(
268264
# population
269265
population = uk_population,
270266
# rate
@@ -283,7 +279,7 @@ output_masks <- model_default(
283279
# create intervention_type column for plotting
284280
output_masks$intervention_type <- "mask mandate"
285281
output_baseline$intervention_type <- "baseline"
286-
output <- rbind(output_masks, output_baseline)
282+
output <- base::rbind(output_masks, output_baseline)
287283
288284
output %>%
289285
filter(compartment == "infectious") %>%
@@ -385,20 +381,18 @@ Here we will assume all age groups are vaccinated at the same rate 0.01 and that
385381

386382
```{r vaccinate}
387383
# prepare a vaccination object
388-
vaccinate <- vaccination(
384+
vaccinate <- epidemics::vaccination(
389385
name = "vaccinate all",
390386
time_begin = matrix(40, nrow(cm_matrix)),
391387
time_end = matrix(40 + 150, nrow(cm_matrix)),
392388
nu = matrix(c(0.01, 0.01, 0.01))
393389
)
394-
395-
vaccinate
396390
```
397391

398392
We pass our vaccination object into the model using the argument `vaccination = vaccinate`:
399393

400394
```{r output_vaccinate}
401-
output_vaccinate <- model_default(
395+
output_vaccinate <- epidemics::model_default(
402396
# population
403397
population = uk_population,
404398
# rate
@@ -425,7 +419,7 @@ Plot the three interventions vaccination, school closure and mask mandate and th
425419
```{r plot_vaccinate, echo = TRUE, message = FALSE, fig.width = 10}
426420
# create intervention_type column for plotting
427421
output_vaccinate$intervention_type <- "vaccination"
428-
output <- rbind(
422+
output <- base::rbind(
429423
output_school,
430424
output_masks,
431425
output_vaccinate,

0 commit comments

Comments
 (0)