-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpart1.qmd
44 lines (35 loc) · 796 Bytes
/
part1.qmd
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
---
title: "Part 1 Solutions"
---
## Exercise 1
```{r}
library(epiworldR)
# Initialize model
model_seir <- ModelSEIR("COVID-19",
prevalence = 0.01,
transmission_rate = 0.9,
recovery_rate = 1/4,
incubation_days = 4)
# Adding a small world population
agents_smallworld(
model_seir,
n = 10000,
k = 5,
d = FALSE,
p = .01
)
# Running model
run(model_seir, ndays = 100, seed = 1912)
# Plotting
plot(model_seir)
# Day of peak infections
x <- get_hist_total(model_seir)
which.max(x$counts[x$state == "Infected"]) - 1
# Number of infections on peak day
max(x$counts[x$state == "Infected"])
```
## Exercise 2
```{r}
repnum <- get_reproductive_number(model_seir)
plot(repnum, type = 'b')
```