Skip to content

Commit 3e8dde7

Browse files
adamkucharskiavallecam
authored andcommitted
Add initial feedback
1 parent 81557f3 commit 3e8dde7

15 files changed

Lines changed: 384 additions & 127 deletions

episodes/compare-interventions.Rmd

Lines changed: 47 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,19 @@ Learners should familiarise themselves with following concept dependencies befor
109109

110110
## Introduction
111111

112-
In this tutorial we will compare intervention scenarios against each other. To quantify the effect of the intervention we need to compare our intervention scenario to a counter factual (baseline) scenario. The *counter factual* here is the scenario in which nothing changes, often referred to as the 'do nothing' scenario. The counter factual scenario may feature no interventions at all or, if we are investigating the potential impact of an additional intervention in the later stages of an outbreak, there may be existing interventions in place.
112+
In this tutorial, we will compare intervention scenarios against each other. To quantify the effect of an intervention, we need to compare our intervention scenario to a counterfactual (baseline) scenario. The *counterfactual* here is the scenario in which nothing changes, often referred to as the "do-nothing" scenario. The counterfactual scenario may feature:
113+
- No interventions at all, or
114+
- Existing interventions in place (if we are investigating the potential impact of an additional intervention)
113115

114-
We must also decide what our *outcome of interest* is to make comparisons between intervention and counter factual scenarios. The outcome of interest can be:
116+
We must also define our *outcome of interest* to make comparisons between intervention and counterfactual scenarios. The outcome of interest can be:
117+
- Direct model outputs (e.g., number of infections, hospitalizations)
118+
- Epidemiological metrics (e.g., epidemic peak time, final outbreak size)
119+
- Health impact measures (e.g., Quality-Adjusted Life Years [QALYs] or Disability-Adjusted Life Years [DALYs])
120+
- Economic measures (e.g., healthcare costs, productivity losses)
115121

116-
+ a model outcome, e.g. number of infections or hospitalisations,
117-
+ a metric such as the epidemic peak time or size,
118-
+ a measure that uses the model outcomes, such as QALY/DALYs.
119-
120-
In this tutorial we are going to learn how to use the `{epidemics}` package to compare the effect of different interventions on simulated disease trajectories. We will access social contact data with `{socialmixr}`. We'll use `{dplyr}`, `{ggplot2}` and the pipe `%>%` to connect some of their functions, so let's also call to the `{tidyverse}` package:
121-
122-
```{r,message=FALSE,warning=FALSE}
123-
library(epidemics)
124-
library(socialmixr)
125-
library(tidyverse)
126-
```
122+
In this tutorial, we will learn how to use the `{epidemics}` package to compare the effect of different interventions on simulated disease trajectories. We will use:
123+
- `{socialmixr}` for social contact data
124+
- `{tidyverse}` (including `{dplyr}` and `{ggplot2}`) for data manipulation and visualization
127125

128126

129127
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
@@ -234,15 +232,16 @@ output %>%
234232

235233
### Vacamole model
236234

237-
The Vacamole model is a deterministic model based on a system of ODEs in [Ainslie et al. 2022](https://doi.org/10.2807/1560-7917.ES.2022.27.44.2101090) to describe the effect of vaccination on COVID-19 dynamics. The model consists of 11 compartments, individuals are classed as one of the following:
235+
The Vacamole model is a deterministic model based on a system of Ordinary Differential Equations (ODEs) developed by [Ainslie et al. (2022)](https://doi.org/10.2807/1560-7917.ES.2022.27.44.2101090) to describe the effect of vaccination on COVID-19 dynamics. The model consists of 11 compartments, where individuals are classified as:
238236

239-
+ susceptible, $S$,
240-
+ partial vaccination ($V_1$), fully vaccination ($V_2$),
241-
+ exposed, $E$ and exposed while vaccinated, $E_V$,
242-
+ infectious, $I$ and infectious while vaccinated, $I_V$,
243-
+ hospitalised, $H$ and hospitalised while vaccinated, $H_V$,
244-
+ dead, $D$,
245-
+ recovered, $R$.
237+
+ Susceptible ($S$)
238+
+ Partially vaccinated ($V_1$)
239+
+ Fully vaccinated ($V_2$)
240+
+ Exposed ($E$) and exposed while vaccinated ($E_V$)
241+
+ Infectious ($I$) and infectious while vaccinated ($I_V$)
242+
+ Hospitalized ($H$) and hospitalized while vaccinated ($H_V$)
243+
+ Dead ($D$)
244+
+ Recovered ($R$)
246245

247246
The diagram below describes the flow of individuals through the different compartments.
248247

@@ -305,17 +304,23 @@ DiagrammeR::grViz("digraph{
305304

306305
## Running a counterfactual scenario using the Vacamole model
307306

308-
1. Run the model with the default parameter values for the UK population assuming that :
307+
1. Run the model with the default parameter values for the UK population assuming that:
309308

310-
+ 1 in a million individual are infectious (and not vaccinated) at the start of the simulation
311-
+ The contact matrix for the United Kingdom has age bins:
312-
+ age between 0 and 20 years,
313-
+ age between 20 and 40,
314-
+ 40 years and over.
309+
+ One in every million individuals (0.0001%) is infectious (and not vaccinated) at the start of the simulation
310+
+ The contact matrix for the United Kingdom has the following age bins:
311+
+ 0-20 years
312+
+ 20-40 years
313+
+ 40+ years
315314

316-
For scenarios :
317-
+ baseline : two dose vaccination program. Dose 1 (vaccination rate 0.01) starts from day 30, dose 2 (vaccination rate 0.01) starts from day 60. Both programs run fro 300 days.
318-
+ intervention :a mask mandate starting from time 60 for 100 days, assuming a reduction in the transmission rate of 0.163
315+
For the following scenarios:
316+
+ Baseline: Two-dose vaccination program
317+
- Dose 1 (vaccination rate 0.01) starts from day 30
318+
- Dose 2 (vaccination rate 0.01) starts from day 60
319+
- Both programs run for 300 days
320+
+ Intervention: Mask mandate
321+
- Starts from day 60
322+
- Lasts for 100 days
323+
- Reduces transmission rate by 16.3% (based on empirical studies of mask effectiveness)
319324

320325
There is no vaccination scheme in place
321326

@@ -476,33 +481,9 @@ output_vacamole %>%
476481

477482
## Calculating outcomes averted
478483

479-
Visualisations are a useful tool to compare intervention scenario model predictions through time. In addition to visualisations, we also want to quantify the impact of interventions. An outcome of interest we can use is the number of infections averted. This measure allows us to quantify the difference between different intervention scenarios.
480-
481-
In `{epidemics}`, we can use the function `outcomes_averted()` to calculate the number of infections averted while accounting for uncertainty in key parameter values. We will extend the COVID-19 example in [Modelling interventions](../episodes/modelling-interventions.md) to account for some uncertainty in the parameter values, specifically in the basic reproduction $R_0$. We do this as follows:
482-
483-
```{r}
484-
# time periods
485-
preinfectious_period <- 4.0
486-
infectious_period <- 5.5
484+
While visualizations are useful for comparing intervention scenarios over time, we also need quantitative measures of intervention impact. One such measure is the number of infections averted, which helps us understand the difference between intervention scenarios.
487485

488-
# specify the mean and standard deviation of R0
489-
r_estimate_mean <- 2.7
490-
r_estimate_sd <- 0.05
491-
492-
# generate 100 R samples
493-
r_samples <- withr::with_seed(
494-
seed = 1,
495-
rnorm(
496-
n = 100, mean = r_estimate_mean, sd = r_estimate_sd
497-
)
498-
)
499-
500-
beta <- r_samples / infectious_period
501-
502-
# rates
503-
infectiousness_rate <- 1.0 / preinfectious_period
504-
recovery_rate <- 1.0 / infectious_period
505-
```
486+
The `{epidemics}` package 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$).
506487

507488
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:
508489

@@ -717,7 +698,15 @@ intervention_effect
717698

718699
::::::::::::::::::::::::::::::::::::: keypoints
719700

720-
- The counter factual scenario must be defined to make comparisons
721-
- Scenarios can be compared using visualisations and by calculating outcomes averted
701+
- A counterfactual (baseline) scenario must be clearly defined for meaningful comparisons
702+
- Scenarios can be compared using both visualizations and quantitative measures
703+
- The outcomes_averted() function helps quantify intervention effects
704+
- Parameter uncertainty should be considered in intervention analysis
722705

723706
::::::::::::::::::::::::::::::::::::::::::::::::
707+
708+
## References
709+
710+
1. Ainslie, K. E., Walters, C. E., Fu, H., Bhatia, S., Wang, H., Xi, X., ... & Ferguson, N. M. (2022). Evidence of initial success for China exiting 'zero-COVID'? Modelling study. Eurosurveillance, 27(44), 2101090.
711+
2. Jarvis, C. I., Van Zandvoort, K., Gimma, A., Prem, K., Klepac, P., Rubin, G. J., & Edmunds, W. J. (2020). Quantifying the impact of physical distance measures on the transmission of COVID-19 in the UK. BMC medicine, 18(1), 1-10.
712+
3. Davies, N. G., Kucharski, A. J., Eggo, R. M., Gimma, A., Edmunds, W. J., & Centre for the Mathematical Modelling of Infectious Diseases COVID-19 Working Group. (2020). Effects of non-pharmaceutical interventions on COVID-19 cases, deaths, and demand for hospital services in the UK: a modelling study. The Lancet Public Health, 5(7), e375-e385.

episodes/contact-matrices.Rmd

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ library(socialmixr)
5050

5151
## The contact matrix
5252

53-
The basic contact matrix represents the amount of contact or mixing within and between different subgroups of a population. The subgroups are often age categories but can also be geographic areas or high/low risk groups. For example, a hypothetical contact matrix representing the average number of contacts per day between children and adults could be:
53+
The basic contact matrix represents the amount of contact or mixing within and between different subgroups of a population. The subgroups are often age categories but can also be:
54+
- Geographic areas (e.g., different regions or countries)
55+
- Risk groups (e.g., high/low risk occupations)
56+
- Social settings (e.g., household, workplace, school)
57+
58+
For example, a hypothetical contact matrix representing the average number of contacts per day between children and adults could be:
5459

5560
$$
5661
\begin{bmatrix}
@@ -63,7 +68,9 @@ In this example, we would use this to represent that children meet, on average,
6368
::::::::::::::::::::::::::::::::::::: callout
6469

6570
### A Note on Notation
66-
For a contact matrix with rows $i$ and columns $j$, we call $C[i,j]$ the average number of contacts of group $i$ with group $j$, calculated as the number of contacts between the two groups averaged across all individuals in group $i$.
71+
For a contact matrix with rows $i$ and columns $j$:
72+
- $C[i,j]$ represents the average number of contacts that individuals in group $i$ have with individuals in group $j$
73+
- This average is calculated as the total number of contacts between groups $i$ and $j$, divided by the number of individuals in group $i$
6774
::::::::::::::::::::::::::::::::::::::::::::::::
6875

6976
## Using `socialmixr`
@@ -99,7 +106,15 @@ For the mathematical explanation see [the corresponding section in the socialmix
99106
::::::::::::::::::::::::::::::::::::: callout
100107
### Why would a contact matrix be non-symmetric?
101108

102-
One of the arguments we gave the function `contact_matrix()` is `symmetric=TRUE`. This ensures that the total number of contacts of age group 1 with age group 2 is the same as the total number of contacts of age group 2 and age group 1 (see the `socialmixr` [vignette](https://cran.r-project.org/web/packages/socialmixr/vignettes/socialmixr.html) for more detail). However, when contact matrices are estimated from surveys or other sources, the *reported* number of contacts may differ by age group resulting in a non-symmetric contact matrix because of biases in recall or reporting across different groups and/or uncertainty from using a limited sample of participants [(Prem et al 2021)](https://doi.org/10.1371/journal.pcbi.1009098). If `symmetric` is set to TRUE, the `contact_matrix()` function will internally use an average of reported contacts to ensure resulting total number of contacts are symmetric.
109+
One of the arguments we gave the function `contact_matrix()` is `symmetric=TRUE`. This ensures that the total number of contacts from one group to another is equal to the total from the second group back to the first (see the `socialmixr` [vignette](https://cran.r-project.org/web/packages/socialmixr/vignettes/socialmixr.html) for more detail).
110+
111+
However, when contact matrices are estimated from surveys or other sources, the *reported* number of contacts may differ by age group for several reasons:
112+
- Recall bias: Different age groups may have different abilities to remember and report contacts accurately
113+
- Reporting bias: Some groups may systematically over- or under-report their contacts
114+
- Sampling uncertainty: Limited sample sizes can lead to statistical variations
115+
[(Prem et al 2021)](https://doi.org/10.1371/journal.pcbi.1009098)
116+
117+
If `symmetric` is set to TRUE, the `contact_matrix()` function will internally use an average of reported contacts to ensure the resulting total number of contacts are symmetric.
103118

104119
::::::::::::::::::::::::::::::::::::::::::::::::
105120

@@ -300,7 +315,9 @@ In this tutorial, we have learnt the definition of the contact matrix, how they
300315

301316
::::::::::::::::::::::::::::::::::::: keypoints
302317

303-
- `socialmixr` can be used to estimate contact matrices from survey data
304-
- Contact matrices can be used in different types of analyses
318+
- Contact matrices quantify the mixing patterns between different population groups
319+
- `socialmixr` provides tools to estimate contact matrices from survey data
320+
- Contact matrices can be used in various epidemiological analyses, from calculating $R_0$ to modeling interventions
321+
- Proper normalization is crucial when using contact matrices in transmission models
305322

306323
::::::::::::::::::::::::::::::::::::::::::::::::
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Here is a summary list of required changes based on the provided .Rmd teaching content:
2+
3+
### Typos and Grammatical Errors
4+
- **"counter factual"** should be consistently written as **"counterfactual"** throughout the document.
5+
- In the sentence "the scenario in which nothing changes, often referred to as the 'do nothing' scenario," consider changing **"do nothing"** to **"do-nothing"** for consistency with hyphenation.
6+
- In the phrase **"both programs run fro 300 days,"** correct **"fro"** to **"for."**
7+
- In the section **"mask mandate,"** the name should be capitalized as **"Mask Mandate"** for consistency with other intervention names.
8+
9+
### Ambiguous Statements or Unclear Explanations
10+
- The term **"outcome of interest"** could be better defined or exemplified earlier in the document to clarify its significance.
11+
- The phrase **"the outcome of interest may simply be the model output"** could be misleading; clarify that the model output is a type of outcome but not the only one.
12+
- In the **"Vacamole model"** section, clarify what **"ODEs"** stands for (Ordinary Differential Equations) for readers who may not be familiar with the term.
13+
14+
### Technical Inconsistencies
15+
- In the **"initial_conditions_vacamole"** section, the variable **"EV"** should be consistently written as **"E_V"** to match the notation used in the model description.
16+
- The **"age bins"** in the challenge section should be clearly defined to match the age limits used in the contact matrix (0-20, 20-40, 40+).
17+
- In the **"Calculating outcomes averted"** section, ensure that the function **`outcomes_averted()`** is properly explained, including its input requirements and expected output.
18+
19+
### Epidemiological Inaccuracies or Imprecision
20+
- The statement **"1 in a million individual are infectious"** should specify whether this is a proportion of the total population or a fixed number for clarity.
21+
- The **"mask mandate"** intervention description should clarify whether the reduction in transmission rate is based on empirical data or theoretical assumptions.
22+
- In the **"Ebola outbreak analysis"** challenge, clarify the implications of a negative number of infections averted, as this could confuse learners regarding the interpretation of stochastic models.
23+
24+
### Additional Suggestions
25+
- Consider adding a **"References"** section at the end to cite the sources mentioned (e.g., Ainslie et al. 2022) for better academic rigor.
26+
- Ensure that all code snippets are properly formatted and tested to avoid runtime errors during the teaching session.
27+
- Include a brief **"Conclusion"** section summarizing the key takeaways from the tutorial to reinforce learning objectives.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Here is a summary list of required changes based on the review of the provided .Rmd teaching content:
2+
3+
### Typos and Grammatical Errors
4+
- **"the average schoolchild has many more daily contact than the average elderly person"**: Change "contact" to "contacts" for grammatical correctness.
5+
- **"2 adult per day"**: Change "adult" to "adults" for grammatical correctness.
6+
- **"the total number of contacts of one group with another is the same as the reverse"**: Consider rephrasing for clarity, e.g., "the total number of contacts from one group to another is equal to the total from the second group back to the first."
7+
- **"the average number of secondary cases won't be equal simply to the average number of contacts multiplied by the probability of transmission-per-contact"**: Consider rephrasing for clarity, e.g., "the average number of secondary cases cannot be simply calculated as the average number of contacts multiplied by the probability of transmission per contact."
8+
9+
### Ambiguous Statements or Unclear Explanations
10+
- **"the average schoolchild has many more daily contact than the average elderly person"**: This statement could be clarified by specifying the context or providing data to support the claim.
11+
- **"the function `r_eff` in the package `{finalsize}` can perform this conversion"**: It may be helpful to briefly explain what `r_eff` does for learners unfamiliar with the function.
12+
- **"the entry $(i,j)$ in a mathematical model contact matrix represents contacts of group $i$ with group $j$"**: This could be clearer if it explicitly states that it refers to the number of contacts, e.g., "the entry $(i,j)$ in a mathematical model contact matrix represents the number of contacts of group $i$ with group $j$."
13+
14+
### Technical Inconsistencies
15+
- **"the contact matrix `contact_data$matrix` is not itself mathematically symmetric"**: This statement may be misleading. If the function is set to `symmetric=TRUE`, it should ensure symmetry in the output. Clarify how the function achieves this.
16+
- **"the maximum eigenvalue of this matrix represents the typical magnitude of contacts, not typical magnitude of transmission"**: This could be misleading; clarify that the eigenvalue relates to the contact structure rather than the transmission dynamics directly.
17+
18+
### Epidemiological Inaccuracies or Imprecision
19+
- **"the average number of secondary cases generated by a typical infectious individual"**: This could be misleading without context. It may be beneficial to clarify that this is an estimate and can vary based on multiple factors.
20+
- **"the scaling factor and the value of $\gamma$"**: It may be useful to explain how $\gamma$ is determined or its significance in the context of the model.
21+
- **"the average number of secondary cases based on this normalised matrix, the result would be 1"**: This statement could be misleading; clarify that this is under specific conditions and assumptions.
22+
23+
### Additional Suggestions
24+
- Consider adding a section on common pitfalls or misconceptions related to contact matrices and their applications in epidemiology.
25+
- Ensure that all references are up-to-date and accessible, as some learners may not have access to certain journals or articles.
26+
- Provide a glossary of key terms used throughout the tutorial to aid understanding for learners who may be new to the subject matter.

0 commit comments

Comments
 (0)