From eaa92fb7b5d8256b0bd81ebaa1979e60ffe7560f Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Tue, 31 Mar 2026 07:03:37 +0300 Subject: [PATCH 1/6] minor text edits to contact-matrices.Rmd --- episodes/contact-matrices.Rmd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/episodes/contact-matrices.Rmd b/episodes/contact-matrices.Rmd index 6a48b0bd..a36f039b 100644 --- a/episodes/contact-matrices.Rmd +++ b/episodes/contact-matrices.Rmd @@ -126,7 +126,7 @@ However, when contact matrices are estimated from surveys or other sources, the - Recall bias: Different age groups may have different abilities to remember and report contacts accurately - Reporting bias: Some groups may systematically over- or under-report their contacts - Sampling uncertainty: Limited sample sizes can lead to statistical variations -[(Prem et al 2021)](https://doi.org/10.1371/journal.pcbi.1009098) +[(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 the resulting total number of contacts are symmetric. @@ -227,7 +227,7 @@ Contact matrices can be used in a wide range of epidemiological analyses, they c + to calculate the basic reproduction number while accounting for different rates of contacts between age groups [(Funk et al. 2019)](https://doi.org/10.1186/s12916-019-1413-7), + to calculate final size of an epidemic, as in the R package `{finalsize}`, + to assess the impact of interventions finding the relative change between pre and post intervention contact matrices to calculate the relative difference in $R_0$ [(Jarvis et al. 2020)](https://doi.org/10.1186/s12916-020-01597-8), -+ and in mathematical models of transmission within a population, to account for group specific contact patterns. ++ and in mathematical models of transmission within a population, to account for group-specific contact patterns. However, all of these applications require us to perform some additional calculations using the contact matrix. Specifically, there are two main calculations we often need to do: @@ -304,7 +304,7 @@ When simulating an epidemic, we often want to ensure that the average number of Rather than just using the raw number of contacts, we can instead normalise the contact matrix to make it easier to work in terms of $R_0$. In particular, we normalise the matrix by scaling it so that if we were to calculate the average number of secondary cases based on this normalised matrix, the result would be 1 (in mathematical terms, we are scaling the matrix so the largest eigenvalue is 1). This transformation scales the entries but preserves their relative values. -In the case of the above model, we want to define $\beta C_{i,j}$ so that the model has a specified valued of $R_0$. If the entry of the contact matrix $C[i,j]$ represents the contacts of population $i$ with $j$, it is equivalent to `contacts_byage$matrix[i,j]`, and the maximum eigenvalue of this matrix represents the typical magnitude of contacts, not typical magnitude of transmission. We must therefore normalise the matrix $C$ so the maximum eigenvalue is one; we call this matrix $C_{normalised}$. Because the rate of recovery is $\gamma$, individuals will be infectious on average for $1/\gamma$ days. So $\beta$ as a model input is calculated from $R_0$, the scaling factor and the value of $\gamma$ (i.e. mathematically we use the fact that the dominant eigenvalue of the matrix $R_0 \times C_{normalised}$ is equal to $\beta / \gamma$). +In the case of the above model, we want to define $\beta C_{i,j}$ so that the model has a specified valued of $R_0$. If the entry of the contact matrix $C[i,j]$ represents the contacts of population $i$ with $j$, it is equivalent to `contacts_byage$matrix[i,j]`, and the maximum eigenvalue of this matrix represents the typical magnitude of contacts, not the typical magnitude of transmission. We must therefore normalise the matrix $C$ so the maximum eigenvalue is one; we call this matrix $C_{normalised}$. Because the rate of recovery is $\gamma$, individuals will be infectious on average for $1/\gamma$ days. So $\beta$ as a model input is calculated from $R_0$, the scaling factor and the value of $\gamma$ (i.e. mathematically we use the fact that the dominant eigenvalue of the matrix $R_0 \times C_{normalised}$ is equal to $\beta / \gamma$). ```{r} contacts_byage_matrix <- t(contacts_byage$matrix) @@ -365,7 +365,7 @@ We can use contact matrices from `socialmixr` with mathematical models in the R ### Contact groups -In the example above the dimension of the contact matrix will be the same as the number of age groups i.e. if there are 3 age groups then the contact matrix will have 3 rows and 3 columns. Contact matrices can be used for other groups as long as the dimension of the matrix matches the number of groups. +In the example above the dimension of the contact matrix will be the same as the number of age groups, i.e. if there are 3 age groups then the contact matrix will have 3 rows and 3 columns. Contact matrices can be used for other groups as long as the dimension of the matrix matches the number of groups. For example, we might have a meta population model with two geographic areas. Then our contact matrix would be a 2 x 2 matrix with entries representing the contact between and within the geographic areas. @@ -373,7 +373,7 @@ For example, we might have a meta population model with two geographic areas. Th ## Summary -In this tutorial, we have learnt the definition of the contact matrix, how they are estimated and how to access social contact data from `socialmixr`. In the next tutorial, we will learn how to use the R package `{epidemics}` to generate disease trajectories from mathematical models with contact matrices from `socialmixr`. +In this tutorial, we have learnt the definition of the contact matrix, how they are estimated and how to access social contact data using `{contactsurveys}` and `{socialmixr}`. In the next tutorial, we will learn how to use the R package `{epidemics}` to generate disease trajectories from mathematical models, with contact matrices using `socialmixr`. ::::::::::::::::::::::::::::::::::::: keypoints From a23d3c776b62518373d314b7adca36ff194a7272 Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Tue, 31 Mar 2026 07:04:27 +0300 Subject: [PATCH 2/6] minor text edits to simulating-transmission.Rmd --- episodes/simulating-transmission.Rmd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/episodes/simulating-transmission.Rmd b/episodes/simulating-transmission.Rmd index e1feb195..1348c165 100644 --- a/episodes/simulating-transmission.Rmd +++ b/episodes/simulating-transmission.Rmd @@ -31,7 +31,7 @@ webshot::install_phantomjs(force = TRUE) + Complete tutorial on [contact matrices](../episodes/contact-matrices.md). -Learners should familiarise themselves with following concept dependencies before working through this tutorial: +Learners should familiarise themselves with the following concept dependencies before working through this tutorial: **Mathematical Modelling**: [Introduction to infectious disease models](https://doi.org/10.1038/s41592-020-0856-2), [state variables](../learners/reference.md#state), [model parameters](../learners/reference.md#parsode), [initial conditions](../learners/reference.md#initial), [differential equations](../learners/reference.md#ordinary). @@ -57,7 +57,7 @@ go to the [main setup page](../learners/setup.md#software-setup). ## Introduction -Mathematical models are useful tools for generating future trajectories of disease spread. In this tutorial, we will use the R package `{epidemics}` to generate disease trajectories of an influenza strain with pandemic potential. By the end of this tutorial, you will be able to generate the trajectory below showing the number of infectious individuals in different age categories over time. +Mathematical models are useful tools for generating trajectories of disease spread. In this tutorial, we will use the R package `{epidemics}` to generate disease trajectories of an influenza strain with pandemic potential. By the end of this tutorial, you will be able to generate the trajectory below showing the number of infectious individuals in different age categories over time. In this tutorial we are going to learn how to use the `{epidemics}` package to simulate disease trajectories and access to 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: @@ -142,7 +142,7 @@ $$ \end{aligned} $$ -Individuals in age group ($i$) move from the susceptible state ($S_i$) to the exposed state ($E_i$) via age-specific contacts with infectious individuals in all groups $\beta S_i \sum_j C_{i,j} I_j/N_j$. The contact matrix $C$ allows for heterogeneity in contacts between age groups. They then move to the infectious state at a rate $\alpha$ and recover at a rate $\gamma$. Note that this model assumes no loss of immunity (there are no flows out of the recovered state), which may not be applicable for all diseases as some allow for reinfection. +Individuals in age group ($i$) move from the susceptible state ($S_i$) to the exposed state ($E_i$) via age-specific contacts with infectious individuals in all groups $\beta S_i \sum_j C_{i,j} I_j/N_j$. The contact matrix $C$ allows for heterogeneity in contacts between age groups. They then move to the infectious state at a rate $\alpha$ and recover at a rate $\gamma$. Note that this model assumes no loss of immunity (meaning there are no flows out of the recovered state), which may not be applicable to all diseases. Immunity wanes more rapidly for certain infections, allowing for reinfection. The model parameters are: @@ -284,9 +284,9 @@ We combine the three initial conditions vectors into one matrix, ```{r initial_conditions} # combine the initial conditions into a matrix class object initial_conditions <- rbind( - initial_conditions_inf, # age group 1 (only group with infectious) - initial_conditions_free, # age group 2 - initial_conditions_free # age group 3 + initial_conditions_inf, # age group [0,20) (only group with infectious) + initial_conditions_free, # age group [20, 40) + initial_conditions_free # age group 40+ ) # use contact matrix to assign age group names From d8b36b10312f4bf0d6f00c59764cd9c70b86fe42 Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Tue, 31 Mar 2026 07:05:08 +0300 Subject: [PATCH 3/6] minor text edits to modelling-interventions.Rmd --- episodes/modelling-interventions.Rmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/episodes/modelling-interventions.Rmd b/episodes/modelling-interventions.Rmd index 7a77fab6..5ad21363 100644 --- a/episodes/modelling-interventions.Rmd +++ b/episodes/modelling-interventions.Rmd @@ -25,7 +25,7 @@ library(epidemics) + Complete tutorial on [Simulating transmission](../episodes/simulating-transmission.md). -Learners should also familiarise themselves with following concept dependencies before working through this tutorial: +Learners should also familiarise themselves with the following concept dependencies before working through this tutorial: **Outbreak response**: [Intervention types](https://www.cdc.gov/nonpharmaceutical-interventions/). @@ -379,7 +379,7 @@ Then continue with the livecoding. ## Pharmaceutical interventions -Pharmaceutical interventions (PIs) are measures such as vaccination and mass treatment programs. In the previous section, we integrated the interventions into the model by reducing parameter values during specific period of time window in which these intervention set to take place. In the case of vaccination, we assume that after the intervention, individuals are no longer susceptible and should be classified into a different disease state. Therefore, we specify the rate at which individuals are vaccinated and track the number of vaccinated individuals over time. +Pharmaceutical interventions (PIs) are measures such as vaccination and mass treatment programs. In the previous section, we integrated the interventions into the model by reducing parameter values during a specific time period in which these intervention are set to take place. In the case of vaccination, we assume that after the intervention, some or all individuals are no longer susceptible and should be classified into a different disease state. Therefore, we specify the rate at which individuals are vaccinated and track the number of vaccinated individuals over time. The diagram below shows the SEIRV model implemented using `model_default()` where susceptible individuals are vaccinated and then move to the $V$ class. @@ -429,9 +429,9 @@ $$ \end{aligned} $$ -Individuals in age group ($i$) at specific time dependent ($t$) are vaccinated at rate ($\nu_{i,t}$). The other SEIR components of these equations are described in the tutorial [simulating transmission](../episodes/simulating-transmission.md#simulating-disease-spread). +Individuals in age group ($i$) at specific time dependent ($t$) are vaccinated at rate ($\nu_{i,t}$). The other SEIR components of these equations are described in the tutorial [simulating transmission](../episodes/simulating-transmission.md#simulating-disease-spread). -To explore the effect of vaccination we need to create a vaccination object to pass as an input into `model_default()` that includes age groups specific vaccination rate `nu` and age groups specific start and end times of the vaccination program (`time_begin` and `time_end`). +To explore the effect of vaccination we need to create a vaccination object to pass as an input into `model_default()` that includes age-group-specific vaccination rate `nu` and age-group-specific start and end times of the vaccination program (`time_begin` and `time_end`). Here we will assume all age groups are vaccinated at the same rate 0.01 and that the vaccination program starts on day 40 and continue to be in place for 150 days. From 85c3eb1776137a23a1d5b16715fc9208bbb7060a Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Tue, 31 Mar 2026 07:05:35 +0300 Subject: [PATCH 4/6] minor text edits to compare-interventions.Rmd --- episodes/compare-interventions.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/episodes/compare-interventions.Rmd b/episodes/compare-interventions.Rmd index 7974ef84..7a430830 100644 --- a/episodes/compare-interventions.Rmd +++ b/episodes/compare-interventions.Rmd @@ -107,7 +107,7 @@ output_baseline <- epidemics::model_default( + Complete tutorials [Simulating transmission](../episodes/simulating-transmission.md) and [Modelling interventions](../episodes/modelling-interventions.md) -Learners should familiarise themselves with following concept dependencies before working through this tutorial: +Learners should familiarise themselves with the following concept dependencies before working through this tutorial: **Outbreak response**: [Intervention types](https://www.cdc.gov/nonpharmaceutical-interventions/). ::::::::::::::::::::::::::::::::: From 94cebadb98819de8a05f81a79ae0cdacf618ab27 Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Tue, 31 Mar 2026 07:05:54 +0300 Subject: [PATCH 5/6] minor text edits to vaccine-comparisons.Rmd --- episodes/vaccine-comparisons.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/episodes/vaccine-comparisons.Rmd b/episodes/vaccine-comparisons.Rmd index 700e3d07..f983eb53 100644 --- a/episodes/vaccine-comparisons.Rmd +++ b/episodes/vaccine-comparisons.Rmd @@ -23,7 +23,7 @@ exercises: 20 + Complete tutorials [Simulating transmission](../episodes/simulating-transmission.md), [Modelling interventions](../episodes/modelling-interventions.md) and [Comparing public health outcomes of interventions](../episodes/compare-interventions.md). -Learners should familiarise themselves with following concept dependencies before working through this tutorial: +Learners should familiarise themselves with the following concept dependencies before working through this tutorial: **Outbreak response**: [Intervention types](https://www.cdc.gov/nonpharmaceutical-interventions/). ::::::::::::::::::::::::::::::::: From a856eeb029dad13bdc41430a927e58f1e11055ad Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Tue, 31 Mar 2026 07:06:31 +0300 Subject: [PATCH 6/6] minor text edits to learners/setup.md --- learners/setup.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/learners/setup.md b/learners/setup.md index 5e077557..afe71478 100644 --- a/learners/setup.md +++ b/learners/setup.md @@ -4,7 +4,7 @@ title: Setup ## Motivation -**Outbreaks** of infectious diseases can appear as a result of different pathogens, and in different contexts, but they typically lead to similar public health questions, from understanding patterns of transmission and severity to examining the effect of control measures ([Cori et al. 2017](https://royalsocietypublishing.org/doi/10.1098/rstb.2016.0371#d1e605)). We can relate each of these public health questions to a series of outbreak data analysis tasks. The more efficiently and reliably we can perform these tasks, the faster and more accurately we can answer the underlying questions. +**Outbreaks** of infectious diseases can appear as a result of different pathogens, and in different contexts, but they typically lead to similar public health questions, from understanding patterns of transmission and severity, to examining the effect of control measures ([Cori et al. 2017](https://royalsocietypublishing.org/doi/10.1098/rstb.2016.0371#d1e605)). We can relate each of these public health questions to a series of outbreak data analysis tasks. The more efficiently and reliably we can perform these tasks, the faster and more accurately we can answer the underlying questions. Epiverse-TRACE aims to provide a software ecosystem for [**outbreak analytics**](reference.md#outbreakanalytics) with integrated, generalisable and scalable community-driven software. We support the development of new R packages, help link together existing tools to make them more user-friendly, and contribute to a community of practice, spanning field epidemiologists, data scientists, lab researchers, health agency analysts, software engineers and more. @@ -40,11 +40,11 @@ Our strategy is to gradually incorporate specialised **R packages** into a tradi :::::::::::::::::::::::::::: prereq -This content assumes intermediate R knowledge. This tutorials are for you if: +This content assumes intermediate R knowledge. These tutorials are for you if: - You can read data into R, transform and reshape data, and make a wide variety of graphs. - You are familiar with functions from `{dplyr}`, `{tidyr}`, and `{ggplot2}`. -- You can use the magrittr pipe `%>%` and/or native pipe `|>`. +- You can use the `{magrittr}` pipe `%>%` and/or native pipe `|>`. We expect learners to have some exposure to basic Statistical, Mathematical and Epidemic theory concepts, but NOT intermediate or expert familiarity with modeling.