33# Practical 4
44# Activity 2
55
6+ # step: fill in your room number
67room_number <- 1 # valid for all
78
89# Group parameters -------------------------------------------------------
@@ -19,6 +20,16 @@ intervention_duration <- 250 # change (e.g., range 150-250)
1920
2021rownames(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
2233test_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)
3448simulate_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+
4965simulate_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+
7294infections_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
78100infections_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)
169191infections_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
175197infections_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)
264286infections_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
270292infections_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