forked from sbfnk/modelling
-
Notifications
You must be signed in to change notification settings - Fork 2
/
results_IBM_location_doc.Rmd
157 lines (121 loc) · 4 KB
/
results_IBM_location_doc.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
---
title: "Location-specific IBM tutorials"
author: "lwillem"
date: "`r Sys.Date()`"
output: pdf_document
---
```{r setup, include=FALSE}
library('curl')
set.seed(2020)
source('lib/ibm_functions.R')
knitr::opts_chunk$set(fig.cap='', fig.align="center", message=FALSE,
warning=FALSE, fig.height = 6, fig.width = 10)
# set default: echo = false
#knitr::opts_chunk$set(echo = FALSE)
```
# Load model code
Please load the IBM functions we prepared on the GitHub repository. Using your skills from the previous tutorial(s), you should be able to code this model yourselves.
If the `curl` packages is not installed yet, you can do so by:
```{r results = "hide", eval=FALSE}
install.packages(curl) # install the curl library (to import data)
```
```{r eval= FALSE}
# load package 'curl'
library('curl')
# download R file with IBM function
curl_download("https://github.com/lwillem/modelling-intro/raw/master/lib/ibm_functions.R",
destfile = "ibm_functions.R")
# load the IBM functions
source('ibm_functions.R')
```
\clearpage
# Base case scenario
```{r }
# you can run the location-specific IBM with default parameters (see console)
run_ibm_location()
```
\clearpage
# Population size 100
```{r pop_size_small, eval=TRUE}
run_ibm_location(pop_size = 100,
rng_seed = 20,
bool_show_demographics = FALSE,
add_baseline = T)
```
\clearpage
# Population size 2000
```{r pop_size_large, eval=TRUE}
run_ibm_location(pop_size = 2000,
rng_seed = 20,
bool_show_demographics = FALSE,
add_baseline = T)
```
\clearpage
# Start with more infected individuals
```{r num_infected_seeds, eval=TRUE}
run_ibm_location(num_infected_seeds = 100,
rng_seed = 20,
bool_show_demographics = FALSE,
add_baseline = T)
```
\clearpage
# Add schools
```{r num_schools, eval=TRUE}
run_ibm_location(num_schools = 10,
rng_seed = 20,
bool_show_demographics = TRUE,
add_baseline = T)
```
\clearpage
# Decrease the number of workplaces
```{r num_workplaces, eval=TRUE}
run_ibm_location(num_workplaces = 20,
rng_seed = 20,
bool_show_demographics = TRUE,
add_baseline = T)
```
\clearpage
# Allow only household contacts
```{r only_hh, eval=TRUE}
run_ibm_location(num_contacts_community_day = 0,
contact_prob_household = 1,
contact_prob_school = 0,
contact_prob_workplace = 0,
rng_seed = 20, bool_show_demographics = FALSE, add_baseline = T)
```
\clearpage
# Allow only household and community contacts
```{r hh_community, eval=TRUE}
run_ibm_location(num_contacts_community_day = 5,
contact_prob_household = 1,
contact_prob_school = 0,
contact_prob_workplace = 0,
rng_seed = 20, bool_show_demographics = FALSE, add_baseline = T)
```
\clearpage
# Allow only school contacts
```{r only_school, eval=TRUE}
run_ibm_location(num_contacts_community_day = 0,
contact_prob_household = 0,
contact_prob_school = 1,
contact_prob_workplace = 0,
rng_seed = 20, bool_show_demographics = FALSE, add_baseline = T)
```
\clearpage
# Allow only household and school contacts
```{r hh_school, eval=TRUE}
run_ibm_location(num_contacts_community_day = 5,
contact_prob_household = 1,
contact_prob_school = 0.5,
contact_prob_workplace = 0,
rng_seed = 20, bool_show_demographics = FALSE, add_baseline = T)
```
\clearpage
# Allow only household and workplace contacts
```{r hh_workplace, eval=TRUE}
run_ibm_location(num_contacts_community_day = 0,
contact_prob_household = 1,
contact_prob_school = 0,
contact_prob_workplace = 0.5,
rng_seed = 20, bool_show_demographics = FALSE, add_baseline = T)
```