Skip to content

Commit 741b24d

Browse files
committed
add namespace and extra comments
1 parent a8b5f4c commit 741b24d

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

episodes/simulating-transmission.Rmd

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ The result is a square matrix with rows and columns for each age group. Contact
231231

232232
### Normalisation
233233

234-
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).
234+
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).
235235

236236
::::::::::::::::::::::::::::::::::::::::::::::::
237237

@@ -276,7 +276,7 @@ initial_conditions_free <- c(
276276
We combine the three initial conditions vectors into one matrix,
277277

278278
```{r initial_conditions}
279-
# combine the initial conditions
279+
# combine the initial conditions into a matrix class object
280280
initial_conditions <- rbind(
281281
initial_conditions_inf, # age group 1
282282
initial_conditions_free, # age group 2
@@ -295,17 +295,20 @@ initial_conditions
295295
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.
296296

297297
```{r demography}
298+
# extract the demography vector
298299
demography_vector <- contact_data$demography$population
300+
301+
# use contact matrix to assign age group names
299302
names(demography_vector) <- rownames(contact_matrix)
300303
demography_vector
301304
```
302305

303-
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.
306+
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.
304307

305308
```{r population}
306309
library(epidemics)
307310
308-
uk_population <- population(
311+
uk_population <- epidemics::population(
309312
name = "UK",
310313
contact_matrix = contact_matrix,
311314
demography_vector = demography_vector,
@@ -385,11 +388,11 @@ For models that are described by [differential equations](../learners/reference.
385388
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.
386389
::::::::::::::::::::::::::::::::::::::::::::::::
387390

388-
Now we are ready to run our model using `model_default()` from the `{epidemics}` package.
391+
Now we are ready to run our model using `epidemics::model_default()` from the `{epidemics}` package.
389392

390393
Let's specify `time_end=600` to run the model for 600 days.
391394
```{r run_model}
392-
output <- model_default(
395+
output <- epidemics::model_default(
393396
# population
394397
population = uk_population,
395398
# rates
@@ -527,7 +530,7 @@ beta <- r_samples / infectious_period
527530
2. Run the model 100 times with $R_0$ equal to a different sample each time
528531

529532
```{r samples}
530-
output_samples <- model_default(
533+
output_samples <- epidemics::model_default(
531534
population = uk_population,
532535
transmission_rate = beta,
533536
infectiousness_rate = infectiousness_rate,

0 commit comments

Comments
 (0)