Skip to content

Commit a68ba2e

Browse files
committed
differences for PR #113
1 parent 04b4e15 commit a68ba2e

5 files changed

Lines changed: 5271 additions & 3 deletions

File tree

.DS_Store

-6 KB
Binary file not shown.

config.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#------------------------------------------------------------
2+
# Values for this lesson.
3+
#------------------------------------------------------------
4+
5+
# Which carpentry is this (swc, dc, lc, or cp)?
6+
# swc: Software Carpentry
7+
# dc: Data Carpentry
8+
# lc: Library Carpentry
9+
# cp: Carpentries (to use for instructor training for instance)
10+
# incubator: The Carpentries Incubator
11+
carpentry: 'epiverse-trace'
12+
13+
# Overall title for pages.
14+
title: 'Scenario modelling for outbreak analytics with R'
15+
16+
# Date the lesson was created (YYYY-MM-DD, this is empty by default)
17+
created:
18+
19+
# Comma-separated list of keywords for the lesson
20+
keywords: 'epidemic models, interventions'
21+
22+
# Life cycle stage of the lesson
23+
# possible values: pre-alpha, alpha, beta, stable
24+
life_cycle: 'pre-alpha'
25+
26+
# License of the lesson materials (recommended CC-BY 4.0)
27+
license: 'CC-BY 4.0'
28+
29+
# Link to the source repository for this lesson
30+
source: 'https://github.com/epiverse-trace/tutorials-late'
31+
32+
# Default branch of your lesson
33+
branch: 'main'
34+
35+
# Who to contact if there are any issues
36+
contact: 'andree.valle-campos@lshtm.ac.uk'
37+
38+
# Navigation ------------------------------------------------
39+
#
40+
# Use the following menu items to specify the order of
41+
# individual pages in each dropdown section. Leave blank to
42+
# include all pages in the folder.
43+
#
44+
# Example -------------
45+
#
46+
# episodes:
47+
# - introduction.md
48+
# - first-steps.md
49+
#
50+
# learners:
51+
# - setup.md
52+
#
53+
# instructors:
54+
# - instructor-notes.md
55+
#
56+
# profiles:
57+
# - one-learner.md
58+
# - another-learner.md
59+
60+
# Order of episodes in your lesson
61+
episodes:
62+
- contact-matrices.Rmd
63+
- simulating-transmission.Rmd
64+
- model-choices.Rmd
65+
- modelling-interventions.Rmd
66+
- compare-interventions.Rmd
67+
- vaccine-comparisons.Rmd
68+
- disease-burden.Rmd
69+
70+
# Information for Learners
71+
learners:
72+
73+
# Information for Instructors
74+
instructors:
75+
76+
# Learner Profiles
77+
profiles:
78+
79+
# Customisation ---------------------------------------------
80+
#
81+
# This space below is where custom yaml items (e.g. pinning
82+
# sandpaper and varnish versions) should live
83+
84+
85+
varnish: epiverse-trace/varnish@epiversetheme
86+
sandpaper: epiverse-trace/sandpaper@patch-renv-github-bug

disease-burden.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ associated with the lessons. They appear in the "Instructor View".
6464

6565
## A burden model
6666

67-
We will extend the influenza example from the [Simulating transmission](../episodes/simulating-transmission.md) tutorial to calculate hospitalizations over time. Our approach has two main components:
67+
We will extend the influenza example from the [Simulating transmission](../episodes/simulating-transmission.md) tutorial by using the `output` object to calculate hospitalizations over time. Our approach has two main components:
6868

6969
1. **Transmission model**: An SEIR model that generates new infections over time
7070
2. **Burden model**: Converts new infections to hospitalizations by accounting for delays between infection and hospitalization
@@ -81,11 +81,77 @@ We'll use `{epiparameter}` to define these delay distributions. The Gamma distri
8181
- It's bounded at zero (negative delays don't make sense)
8282
- It's supported by empirical data for many infectious diseases
8383

84+
:::::::::::::::: instructor
8485

8586

87+
``` r
88+
# load contact and population data from socialmixr::polymod
89+
polymod <- socialmixr::polymod
90+
contact_data <- socialmixr::contact_matrix(
91+
polymod,
92+
countries = "United Kingdom",
93+
age.limits = c(0, 20, 40),
94+
symmetric = TRUE
95+
)
96+
97+
# prepare contact matrix
98+
contact_matrix <- t(contact_data$matrix)
99+
100+
# prepare the demography vector
101+
demography_vector <- contact_data$demography$population
102+
names(demography_vector) <- rownames(contact_matrix)
103+
104+
# initial conditions: one in every 1 million is infected
105+
initial_i <- 1e-6
106+
initial_conditions_inf <- c(
107+
S = 1 - initial_i, E = 0, I = initial_i, R = 0, V = 0
108+
)
109+
110+
initial_conditions_free <- c(
111+
S = 1, E = 0, I = 0, R = 0, V = 0
112+
)
113+
114+
# build for all age groups
115+
initial_conditions <- rbind(
116+
initial_conditions_inf,
117+
initial_conditions_free,
118+
initial_conditions_free
119+
)
120+
rownames(initial_conditions) <- rownames(contact_matrix)
121+
122+
# prepare the population to model as affected by the epidemic
123+
uk_population <- epidemics::population(
124+
name = "UK",
125+
contact_matrix = contact_matrix,
126+
demography_vector = demography_vector,
127+
initial_conditions = initial_conditions
128+
)
129+
130+
# time periods
131+
preinfectious_period <- 3.0
132+
infectious_period <- 7.0
133+
basic_reproduction <- 1.46
134+
135+
# rates
136+
infectiousness_rate <- 1.0 / preinfectious_period
137+
recovery_rate <- 1.0 / infectious_period
138+
transmission_rate <- basic_reproduction / infectious_period
139+
140+
# run an epidemic model using `epidemic()`
141+
output <- epidemics::model_default(
142+
population = uk_population,
143+
transmission_rate = transmission_rate,
144+
infectiousness_rate = infectiousness_rate,
145+
recovery_rate = recovery_rate,
146+
time_end = 600, increment = 1.0
147+
)
148+
```
149+
150+
::::::::::::::::
151+
86152

87153
``` r
88-
new_cases <- new_infections(output_plot, by_group = FALSE)
154+
new_cases <- new_infections(output, by_group = FALSE)
89155
head(new_cases)
90156
```
91157

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"episodes/modelling-interventions.Rmd" "4ddf2a3e860dc11ba7a29ad20228eb3a" "site/built/modelling-interventions.md" "2025-08-19"
1111
"episodes/compare-interventions.Rmd" "2ef6697bbad9bcfb843ab9d50469123b" "site/built/compare-interventions.md" "2025-08-19"
1212
"episodes/vaccine-comparisons.Rmd" "bb9110b17b2b5cdc915df3f17eae15df" "site/built/vaccine-comparisons.md" "2025-08-19"
13-
"episodes/disease-burden.Rmd" "05199c08e0f4394b341dd67b00f7a130" "site/built/disease-burden.md" "2025-08-19"
13+
"episodes/disease-burden.Rmd" "9deead362349c98be8f1d9380a7b975a" "site/built/disease-burden.md" "2025-08-19"
1414
"instructors/instructor-notes.md" "ca3834a1b0f9e70c4702aa7a367a6bb5" "site/built/instructor-notes.md" "2025-08-19"
1515
"learners/BF_measles.Rmd" "5725a25d664730bbce3736a3243c2182" "site/built/BF_measles.md" "2025-08-19"
1616
"learners/reference.md" "9e836f1ec999f95f55135cdd2c78d2e6" "site/built/reference.md" "2025-08-19"

0 commit comments

Comments
 (0)