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
In this tutorial, we will learn how to use the R package `{epidemics}` to compare the effect of different interventions on simulated disease trajectories. We will use:
125
-
-`{socialmixr}` for social contact data
126
-
-`{tidyverse}` (including `{dplyr}` and `{ggplot2}`) for data manipulation and visualization
124
+
In this tutorial, we will learn how to use the R package `{epidemics}` to compare the effect of different interventions on simulated disease trajectories. We will use `{socialmixr}` for social contact data and `{tidyverse}` (including `{dplyr}`, `{ggplot2}`, and the pipe `%>%`) for data manipulation and visualization.
@@ -487,10 +490,34 @@ While visualizations are useful for comparing intervention scenarios over time,
487
490
488
491
The R package `{epidemics}` provides the `outcomes_averted()` function to calculate infections averted while accounting for parameter uncertainty. Let's extend our COVID-19 example from [Modelling interventions](../episodes/modelling-interventions.md) to account for uncertainty in the basic reproduction number ($R_0$).
489
492
493
+
```{r}
494
+
# time periods
495
+
preinfectious_period <- 4.0
496
+
infectious_period <- 5.5
497
+
498
+
# specify the mean and standard deviation of R0
499
+
r_estimate_mean <- 2.7
500
+
r_estimate_sd <- 0.05
501
+
502
+
# generate 100 R samples
503
+
r_samples <- withr::with_seed(
504
+
seed = 1,
505
+
rnorm(
506
+
n = 100, mean = r_estimate_mean, sd = r_estimate_sd
507
+
)
508
+
)
509
+
510
+
beta <- r_samples / infectious_period
511
+
512
+
# rates
513
+
infectiousness_rate <- 1.0 / preinfectious_period
514
+
recovery_rate <- 1.0 / infectious_period
515
+
```
516
+
490
517
We use these parameter values alongside the population structure and contact matrix used in [Modelling interventions](../episodes/modelling-interventions.md) to run the model for the baseline scenario:
The output gives us the infections averted in each scenario compared to the baseline. To obtain the infections averted overall we specify `by_group = FALSE`:
0 commit comments