-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpart_1.R
73 lines (62 loc) · 2.11 KB
/
part_1.R
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
# Install and load the packages we need!
# install.packages("tidyverse")
# install.packages("nimue")
# install.packages("purrr")
# install.packages("furrr")
library(tidyverse)
library(purrr)
library(nimue)
library(furrr)
##########################################################################
# in the "Help" window, open the nimue pacakge, and the function "run" to see the options
##########################################################################
# First we are going to do some example runs of the base model
#########################################################################
# Run the model with an example population and no vaccination
no_vaccine <- nimue::run(country = "United Kingdom",
max_vaccine = 0,
R0 = 2)
# Format the output selecting infection and deaths
out1 <-
format(no_vaccine,
compartments = NULL,
summaries = c("infections", "deaths")) %>%
mutate(Name = "No vaccine")
# Plot outputs
ggplot(data = out1, aes(x = t, y = value, group = Name, col = Name)) +
geom_line(size = 1) +
facet_wrap(~ compartment, scales = "free_y", ncol = 2) +
xlim(0, 200) +
xlab("Time") +
theme_bw()
#########################################################################
# Run the model with an example population and infection-blocking vaccine
infection_blocking <- nimue::run(
country = "United Kingdom",
R0 = 2.5,
max_vaccine = 100000,
vaccine_efficacy_disease = rep(0, 17),
vaccine_efficacy_infection = rep(0.9, 17)
)
# Format the output selecting infection and deaths
out2 <-
format(
infection_blocking,
compartments = NULL,
summaries = c("infections", "deaths")
) %>%
mutate(Name = "Infection blocking")
# Create plot data.frame
pd <- bind_rows(out1, out2)
# Plot outputs
ggplot(pd, aes(x = t, y = value, group = Name, col = Name)) +
geom_line(size = 1) +
facet_wrap(~ compartment, scales = "free_y", ncol = 2) +
xlim(0, 200) +
xlab("Time") +
theme_bw()
#########################################################################
# Things to try:
# - vary dose availability
# - vary R0
# - vary vaccine efficacy