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/simulating-transmission.Rmd
+54-9Lines changed: 54 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -454,7 +454,8 @@ output %>%
454
454
aes(
455
455
x = time,
456
456
y = value,
457
-
colour = demography_group
457
+
color = demography_group,
458
+
linetype = compartment
458
459
)
459
460
) +
460
461
scale_y_continuous(
@@ -472,22 +473,66 @@ output %>%
472
473
::::::::::::::::::::::::::::::::::::: callout
473
474
### Time increments
474
475
475
-
Note that there is a default argument of `increment = 1`. This relates to the time step of the ODE solver. When the parameters are specified on a daily time-scale and maximum number of time steps (`time_end`) is days, the default time step of the ODE solver one day.
476
+
Note that there is a default argument of `increment = 1`. This relates to the time step of the ODE solver. When the parameters are specified on a daily timescale and the maximum number of time steps (`time_end`) is days, the default time step of the ODE solver is one day.
476
477
477
-
The choice of increment will depend on the time scale of the parameters, and the rate at which events can occur. In general, the increment should be smaller than the fastest event that can occur. For example:
478
+
The choice of increment will depend on the time scale of the parameters and the rate at which events can occur. In general, the increment should be smaller than the fastest event that can occur. For example:
478
479
479
-
-if parameters are on a daily time scale, and all events are reported on a daily basis, then the increment should be equal to one day;
480
-
-if parameters are on a monthly time scale, but some events will occur within a month, then the increment should be less than one month.
480
+
-If parameters are on a *daily* time scale, and all events are reported on a daily basis, then the increment should be equal to one day;
481
+
-If parameters are on a *monthly* time scale, but some events will occur within a month, then the increment should be less than one month.
481
482
482
483
::::::::::::::::::::::::::::::::::::::::::::::::
483
484
485
+
:::::::::::::::: testimonial
486
+
487
+
**Two helper functions in `{epidemics}`**
488
+
489
+
Use `epidemics::epidemic_peak()` to get the time and size of a compartment's highest peak for all demographic groups. By default, this will calculate for the infectious compartment.
490
+
491
+
```{r}
492
+
epidemics::epidemic_peak(data = output)
493
+
```
494
+
495
+
Use `epidemics::epidemic_size()` to get the size of the epidemic at any stage between the start and the end. This is calculated as the number of individuals *recovered* from infection at that stage of the epidemic.
496
+
497
+
```{r}
498
+
epidemics::epidemic_size(data = output)
499
+
```
500
+
501
+
These summary functions can help you get outputs relevant to scenario comparisons or any other downstream analysis.
502
+
503
+
::::::::::::::::
504
+
505
+
The figure above shows the total number or cumulative amount of individuals in the infectious compartment at each time.
506
+
If you want to show the *total burden* of the disease, the `infectious` compartment is the most appropriate.
507
+
On the other hand, if you want to show the *daily burden*, then you could use `epidemics::new_infections()` to get the daily incidence.
508
+
509
+
::::::::::::::::::::::: spoiler
510
+
511
+
Notice that the number of new infected individuals at each time (as in the figure below) is lower than the cumulative number of infectious individuals at each time (as in the figure above).
The epidemic model is [deterministic](../learners/reference.md#deterministic), which means it runs like clockwork: the same parameters will always lead to the same trajectory. A deterministic model is one where the outcome is completely determined by the initial conditions and parameters, with no random variation. However, reality is not so predictable. There are two main reasons for this: the transmission process can involve randomness, and we may not know the exact epidemiological characteristics of the pathogen we're interested in. In the next episode, we will consider 'stochastic' models (i.e. models where we can define the process that creates randomness in transmission). In the meantime, we can include uncertainty in the value of the parameters that go into the deterministic model. To account for this, we must run our model for different parameter combinations.
487
532
488
-
We ran our model with $R_0= 1.5$. However, we believe that $R_0$ follows a normal distribution with mean 1.5 and standard deviation 0.05. To account for uncertainty we will run the model for different values of $R_0$. The steps we will follow to do this are:
533
+
We ran our model with $R_0= 1.5$. However, we believe that $R_0$ follows a normal distribution with mean 1.5 and standard deviation 0.05. To account for uncertainty, we will run the model for different values of $R_0$. The steps we will follow to do this are:
489
534
490
-
1. Obtain 100 samples from the from a normal distribution
3. Calculate the mean and 95% quantiles of number of infectious individuals across each model simulation and visualise output
566
+
3. Calculate the mean and 95% quantiles of the number of infectious individuals across each model simulation and visualise the output
522
567
523
568
```{r plot, fig.width = 10}
524
569
output_samples %>%
@@ -548,7 +593,7 @@ output_samples %>%
548
593
```
549
594
550
595
551
-
Deciding which parameters to include uncertainty in depends on a few factors: how well informed a parameter value is e.g. consistency of estimates from the literature; how sensitive model outputs are to parameter value changes; and the purpose of the modelling task. See [McCabe et al. 2021](https://doi.org/10.1016%2Fj.epidem.2021.100520) to learn about different types of uncertainty in infectious disease modelling.
596
+
Deciding which parameters to include uncertainty in depends on a few factors: how well informed a parameter value is, e.g. consistency of estimates from the literature; how sensitive model outputs are to parameter value changes; and the purpose of the modelling task. See [McCabe et al. 2021](https://doi.org/10.1016%2Fj.epidem.2021.100520) to learn about different types of uncertainty in infectious disease modelling.
0 commit comments