You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: episodes/modelling-interventions.Rmd
+19-13Lines changed: 19 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,7 @@ In this tutorial, we will learn how to use `{epidemics}` to model interventions
57
57
58
58
```{r,message=FALSE,warning=FALSE}
59
59
library(epidemics)
60
+
library(contactsurveys)
60
61
library(socialmixr)
61
62
library(tidyverse)
62
63
```
@@ -85,23 +86,28 @@ We will investigate the effect of interventions on a COVID-19 outbreak using an
85
86
The SEIR model divides the population into four compartments: Susceptible (S), Exposed (E), Infectious (I), and Recovered (R). We will set the following parameters for our model: $R_0 = 2.7$ (basic reproduction number), latent period or pre-infectious period $= 4$ days, and the infectious period $= 5.5$ days (parameters adapted from [Davies et al. (2020)](https://doi.org/10.1016/S2468-2667(20)30133-X)). We adopt a contact matrix with age bins 0-18, 18-65, 65 years and older using `{socialmixr}`, and assume that one in every 1 million individuals in each age group is infectious at the start of the epidemic.
# prepare the population to model as affected by the epidemic
125
131
uk_population <- epidemics::population(
126
132
name = "UK",
127
-
contact_matrix = cm_matrix,
133
+
contact_matrix = contacts_byage_matrix,
128
134
demography_vector = demography_vector,
129
135
initial_conditions = initial_conditions
130
136
)
@@ -176,7 +182,7 @@ The first NPI we will consider is the effect of school closures on reducing the
176
182
To include an intervention in our model we must create an `intervention` object. The inputs are the name of the intervention (`name`), the type of intervention (`contacts` or `rate`), the start time (`time_begin`), the end time (`time_end`) and the reduction (`reduction`). The values of the reduction matrix are specified in the same order as the age groups in the contact matrix.
177
183
178
184
```{r}
179
-
rownames(cm_matrix)
185
+
rownames(contacts_byage_matrix)
180
186
```
181
187
182
188
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:
@@ -433,8 +439,8 @@ Here we will assume all age groups are vaccinated at the same rate 0.01 and that
Remember that the matrix satisfies the `symmetric = TRUE` condition at the level of total number of contacts.
218
224
219
-
The total number of contacts between groups $i$ and $j$ is calculated as the mean number of contacts (`contact_data$matrix`) multiplied by the number of individuals in group $i$ (`contact_data$demography$population`)
225
+
The total number of contacts between groups $i$ and $j$ is calculated as the mean number of contacts (`contacts_byage$matrix`) multiplied by the number of individuals in group $i$ (`contacts_byage$demography$population`)
The population object requires a vector containing the demographic structure of the population. The demographic vector must be a named vector containing the number of individuals in each age group of our given population. In this example, we can extract the demographic information from the `contact_data` object that we obtained using the `socialmixr` package.
301
+
The population object requires a vector containing the demographic structure of the population. The demographic vector must be a named vector containing the number of individuals in each age group of our given population. In this example, we can extract the demographic information from the `contacts_byage` object that we obtained using the `socialmixr` package.
0 commit comments