Skip to content

Commit c2405ef

Browse files
committed
add steps to part two
1 parent bfedda4 commit c2405ef

File tree

2 files changed

+55
-10
lines changed

2 files changed

+55
-10
lines changed

instructors/data/04-practical-activity-2.R

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,35 @@
33
# Practical 4
44
# Activity 2
55

6+
# step: fill in your room number
67
room_number <- #<COMPLETE> replace with 1/2/3/4
78

89
# Intervention ---------------------------------------------------------
910

1011
rownames(socialcontact_matrix)
1112

12-
test_intervention <- epidemics::intervention(
13-
#<COMPLETE>
13+
# step: create the intervention object:
14+
# identify if you need to keep:
15+
# epidemics::intervention() or epidemics::vaccination()
16+
# then add:
17+
# - name of the intervention
18+
# - type of intervention ("rate" or "contacts"), if needed
19+
# - time when the intervention begins and ends (as values or matrix*)
20+
# as given in table of inputs
21+
# - reduction or vaccination rate (as values or matrix*)
22+
# *if matrix, values follow same order as in the social contact matrix
23+
test_intervention <- epidemics::intervention(#<COMPLETE>
24+
)
25+
test_intervention <- epidemics::vaccination(#<COMPLETE>
1426
)
1527

1628
test_intervention
1729

1830
# Run {epidemics} ---------------------------------------------------------
1931

32+
# step: add the intervention argument
33+
# as a list (for interventions against contacts or transmission rate)
34+
# or as an object (for vaccination)
2035
simulate_intervention <- epidemics::model_default(
2136
population = population_object,
2237
transmission_rate = transmission_rate,
@@ -32,6 +47,8 @@ simulate_intervention
3247

3348
# Plot all compartments --------------------------------------------------
3449

50+
# step: paste plot and table output in report
51+
3552
simulate_intervention %>%
3653
ggplot(aes(
3754
x = time,
@@ -55,16 +72,22 @@ epidemics::epidemic_peak(data = simulate_intervention)
5572
# Visualize effect --------------------------------------------------------
5673
# Plot new infections
5774

75+
# step:
76+
# add intervention name
77+
# if your intervention is vaccination, then
78+
# activate the argument compartments_from_susceptible
79+
# run and paste plot output in report
80+
5881
infections_baseline <- epidemics::new_infections(
5982
data = simulate_baseline,
6083
# compartments_from_susceptible = "vaccinated", # if vaccination
61-
by_group = FALSE # if TRUE, then age-stratified
84+
by_group = FALSE # if TRUE, then age-stratified output
6285
)
6386

6487
infections_intervention <- epidemics::new_infections(
6588
data = simulate_intervention,
6689
# compartments_from_susceptible = "vaccinated", # if vaccination
67-
by_group = FALSE # if TRUE, then age-stratified
90+
by_group = FALSE # if TRUE, then age-stratified output
6891
)
6992

7093
# Assign scenario names

instructors/fig/04-practical-instructor-2.R

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Practical 4
44
# Activity 2
55

6+
# step: fill in your room number
67
room_number <- 1 #valid for all
78

89
# Group parameters -------------------------------------------------------
@@ -19,6 +20,16 @@ intervention_duration <- 250 # change (e.g., range 150-250)
1920

2021
rownames(socialcontact_matrix)
2122

23+
# step: create the intervention object:
24+
# identify if you need to keep:
25+
# epidemics::intervention() or epidemics::vaccination()
26+
# then add:
27+
# - name of the intervention
28+
# - type of intervention ("rate" or "contacts"), if needed
29+
# - time when the intervention begins and ends (as values or matrix*)
30+
# as given in table of inputs
31+
# - reduction or vaccination rate (as values or matrix*)
32+
# *if matrix, values follow same order as in the social contact matrix
2233
test_intervention <- epidemics::intervention(
2334
name = "School closure",
2435
type = "contacts",
@@ -31,6 +42,9 @@ test_intervention
3142

3243
# Run {epidemics} ---------------------------------------------------------
3344

45+
# step: add the intervention argument
46+
# as a list (for interventions against contacts or transmission rate)
47+
# or as an object (for vaccination)
3448
simulate_intervention <- epidemics::model_default(
3549
population = population_object,
3650
transmission_rate = transmission_rate,
@@ -46,6 +60,8 @@ simulate_intervention
4660

4761
# Plot all compartments --------------------------------------------------
4862

63+
# step: paste plot and table output in report
64+
4965
simulate_intervention %>%
5066
ggplot(aes(
5167
x = time,
@@ -69,16 +85,22 @@ epidemics::epidemic_peak(data = simulate_intervention)
6985
# Visualize effect --------------------------------------------------------
7086
# Plot new infections
7187

88+
# step:
89+
# add intervention name
90+
# if your intervention is vaccination, then
91+
# activate the argument compartments_from_susceptible
92+
# run and paste plot output in report
93+
7294
infections_baseline <- epidemics::new_infections(
7395
data = simulate_baseline,
7496
# compartments_from_susceptible = "vaccinated", # if vaccination
75-
by_group = FALSE # if TRUE, then age-stratified
97+
by_group = FALSE # if TRUE, then age-stratified output
7698
)
7799

78100
infections_intervention <- epidemics::new_infections(
79101
data = simulate_intervention,
80102
# compartments_from_susceptible = "vaccinated", # if vaccination
81-
by_group = FALSE # if TRUE, then age-stratified
103+
by_group = FALSE # if TRUE, then age-stratified output
82104
)
83105

84106
# Assign scenario names
@@ -169,13 +191,13 @@ epidemics::epidemic_peak(data = simulate_intervention)
169191
infections_baseline <- epidemics::new_infections(
170192
data = simulate_baseline,
171193
# compartments_from_susceptible = "vaccinated", # if vaccination
172-
by_group = FALSE # if TRUE, then age-stratified
194+
by_group = FALSE # if TRUE, then age-stratified output
173195
)
174196

175197
infections_intervention <- epidemics::new_infections(
176198
data = simulate_intervention,
177199
# compartments_from_susceptible = "vaccinated", # if vaccination
178-
by_group = FALSE # if TRUE, then age-stratified
200+
by_group = FALSE # if TRUE, then age-stratified output
179201
)
180202

181203
# Assign scenario names
@@ -264,13 +286,13 @@ epidemics::epidemic_peak(data = simulate_intervention)
264286
infections_baseline <- epidemics::new_infections(
265287
data = simulate_baseline,
266288
compartments_from_susceptible = "vaccinated", # if vaccination
267-
by_group = FALSE # if TRUE, then age-stratified
289+
by_group = FALSE # if TRUE, then age-stratified output
268290
)
269291

270292
infections_intervention <- epidemics::new_infections(
271293
data = simulate_intervention,
272294
compartments_from_susceptible = "vaccinated", # if vaccination
273-
by_group = FALSE # if TRUE, then age-stratified
295+
by_group = FALSE # if TRUE, then age-stratified output
274296
)
275297

276298
# Assign scenario names

0 commit comments

Comments
 (0)