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
Remember that the matrix satisfies the `symmetric = TRUE` condition at the level of total number of contacts.
196
+
197
+
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`)
@@ -202,7 +218,7 @@ The result is a square matrix with rows and columns for each age group. Contact
202
218
203
219
### Normalisation
204
220
205
-
In `{epidemics}` the contact matrix normalisation happens within the function call, so we don't need to normalise the contact matrix before we pass it to `population()` (see section 3. Population Structure). For details on normalisation, see the tutorial on [Contact matrices](../episodes/contact-matrices.md).
221
+
In `{epidemics}` the contact matrix normalisation happens within the function call, so we don't need to normalise the contact matrix before we pass it to `epidemics::population()` (see section 3. Population Structure). For details on normalisation, see the tutorial on [Contact matrices](../episodes/contact-matrices.md).
206
222
207
223
::::::::::::::::::::::::::::::::::::::::::::::::
208
224
@@ -227,12 +243,16 @@ The initial conditions in the first age category are $S(0)=1-\frac{1}{1,000,000}
227
243
228
244
229
245
```r
246
+
# 1 in 1,000,000 is equivalent to 1e-6
230
247
initial_i<-1e-6
231
248
initial_conditions_inf<- c(
232
249
S=1-initial_i, E=0, I=initial_i, R=0, V=0
233
250
)
234
251
```
235
252
253
+
Note that R uses scientific `e` notation where `e` tells you to multiple the base number by 10 raised to the power shown ([DataKwery, 2020](https://www.datakwery.com/post/2020-07-11-scientific-notation-in-r/)).
254
+
The expression $1 \times 10^{-6}$ is equivalent to `1e-6`.
255
+
236
256
For the age categories that are free from infection, the initial conditions are $S(0)=1$, $E(0) =0$, $I(0)=0$, $R(0)=0$. We specify this as follows,
237
257
238
258
@@ -246,15 +266,15 @@ We combine the three initial conditions vectors into one matrix,
246
266
247
267
248
268
```r
249
-
# combine the initial conditions
269
+
# combine the initial conditions into a matrix class object
250
270
initial_conditions<- rbind(
251
-
initial_conditions_inf, # age group 1
271
+
initial_conditions_inf, # age group 1 (only group with infectious)
To create our population object, from the `{epidemics}` package we call the function `population()` specifying a name, the contact matrix, the demography vector and the initial conditions.
309
+
To create our population object, from the `{epidemics}` package we call the function `epidemics::population()` specifying a name, the contact matrix, the demography vector and the initial conditions.
287
310
288
311
289
312
```r
290
313
library(epidemics)
291
314
292
-
uk_population<- population(
315
+
uk_population<-epidemics::population(
293
316
name="UK",
294
-
contact_matrix=contact_matrix,
317
+
contact_matrix=socialcontact_matrix,
295
318
demography_vector=demography_vector,
296
319
initial_conditions=initial_conditions
297
320
)
@@ -371,12 +394,12 @@ For models that are described by [differential equations](../learners/reference.
371
394
An _ODE solver_ is the software used to find numerical solutions to differential equations. If interested on how a system of differential equations is solved in `{epidemics}`, we suggest you to read the section on [ODE systems and models](https://epiverse-trace.github.io/epidemics/articles/design-principles.html#ode-systems-and-models) at the "Design principles" vignette.
372
395
::::::::::::::::::::::::::::::::::::::::::::::::
373
396
374
-
Now we are ready to run our model using `model_default()` from the `{epidemics}` package.
397
+
Now we are ready to run our model using `epidemics::model_default()` from the `{epidemics}` package.
375
398
376
399
Let's specify `time_end=600` to run the model for 600 days.
0 commit comments