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
From the plot we see that the peak number of total number of infectious individuals when vaccination is in place is much lower compared to school closures and maskwearing interventions.
427
+
From the plot, we see that the peak number of total number of infectious individuals when vaccination is in place is much lower compared to school closures and mask-wearing interventions.
428
428
429
429
:::::::::::::::::::::::::::::::::
430
430
::::::::::::::::::::::::::::::::::::::::::::::::
431
431
432
+
Lastly, if you are interested in plotting the trajectory of new infections from an `epidemics::model_default()` with a `vaccination` intervention, you need to specify one additional argument.
433
+
At `epidemics::new_infections()` specify `compartments_from_susceptible = "vaccinated"` to name the model compartments into which individuals transition from the "susceptible" compartment, and which are not related to infection. In the scenario above, "vaccinated" individuals who are no longer susceptible should not be counted as infected.
432
434
435
+
::::::::::::::::::::: spoiler
436
+
437
+
Notice that if we use `by_group = FALSE` in `epidemics::new_infections()`, we get a summary of the new infections in all demographic groups.
438
+
To get an age-stratified plot, keep the default `by_group = TRUE` and then add `linetype = demography_group` when declaring variables in `ggplot(aes(...))`.
439
+
440
+
441
+
```r
442
+
infections_baseline<-epidemics::new_infections(
443
+
data=output_baseline,
444
+
compartments_from_susceptible="vaccinated", # if vaccination
Copy file name to clipboardExpand all lines: simulating-transmission.md
+72-9Lines changed: 72 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -360,7 +360,8 @@ output %>%
360
360
aes(
361
361
x=time,
362
362
y=value,
363
-
colour=demography_group
363
+
color=demography_group,
364
+
linetype=compartment
364
365
)
365
366
) +
366
367
scale_y_continuous(
@@ -380,22 +381,84 @@ output %>%
380
381
::::::::::::::::::::::::::::::::::::: callout
381
382
### Time increments
382
383
383
-
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.
384
+
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.
384
385
385
-
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:
386
+
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:
386
387
387
-
-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;
388
-
-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.
388
+
-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;
389
+
-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.
389
390
390
391
::::::::::::::::::::::::::::::::::::::::::::::::
391
392
393
+
:::::::::::::::: testimonial
394
+
395
+
**Two helper functions in `{epidemics}`**
396
+
397
+
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.
398
+
399
+
400
+
```r
401
+
epidemics::epidemic_peak(data=output)
402
+
```
403
+
404
+
```output
405
+
demography_group compartment time value
406
+
<char> <char> <num> <num>
407
+
1: [0,20) infectious 315 651944.3
408
+
2: [20,40) infectious 319 625863.8
409
+
3: 40+ infectious 322 858259.1
410
+
```
411
+
412
+
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.
413
+
414
+
415
+
```r
416
+
epidemics::epidemic_size(data=output)
417
+
```
418
+
419
+
```output
420
+
[1] 9285873 9040679 12540088
421
+
```
422
+
423
+
These summary functions can help you get outputs relevant to scenario comparisons or any other downstream analysis.
424
+
425
+
::::::::::::::::
426
+
427
+
The figure above shows the total number or cumulative amount of individuals in the infectious compartment at each time.
428
+
If you want to show the *total burden* of the disease, the `infectious` compartment is the most appropriate.
429
+
On the other hand, if you want to show the *daily burden*, then you could use `epidemics::new_infections()` to get the daily incidence.
430
+
431
+
::::::::::::::::::::::: spoiler
432
+
433
+
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.
395
458
396
-
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:
459
+
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:
397
460
398
-
1. Obtain 100 samples from the from a normal distribution
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.
527
+
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