-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.qmd
135 lines (104 loc) · 5.36 KB
/
index.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
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
---
title: "epiworldR Sunbelt 2023 Workshop"
---
::: {style="width: 70%;margin:auto;"}
```{r}
#| warning: false
#| echo: true
#| code-fold: true
#| fig-align: center
#| fig-format: retina
#| label: fig-epiworldR
library(epiworldR)
# Creating a model
mymodel <- ModelSEIRCONN(
name = "Nasty virus", n = 10000, prevalence = .001, contact_rate = 4,
transmission_rate = .4, incubation_days = 7, recovery_rate = 1/7
) |> verbose_off()
# Adding a virus
add_virus(mymodel, virus("Nasty virus 2", .5, .3), proportion = .001)
# Renaming the model
set_name(mymodel, mname = "SEIR COVID-19 model")
# Running the model
set.seed(8383)
run(mymodel, ndays = 100)
op <- par(mfrow = c(2, 2), mar = par()$mar * c(1, 1, 1/2, 0))
plot(mymodel)
plot_reproductive_number(mymodel)
plot_incidence(mymodel)
plot_generation_time(mymodel)
par(op)
```
:::
The [**`epiworldR`**](https://uofuepibio.github.io/epiworldR){target="_blank"} R package is a wrapper of the C++ library [epiworld](https://github.com/UofUEpi/epiworld). It provides a general framework for modeling disease transmission using agent-based models [wiki](https://en.wikipedia.org/w/index.php?title=Agent-based_model&oldid=1153634802). Some main features include:
- Fast simulation with an average of 30 million agents/day per second.
- Multiple-disease simulation.
- Policies (tools) can be multiple and user-defined.
- Out-of-the-box parallel computing.
- Transmission and recovery rates based on comorbidities.
- Etc.
::: {style="width: 70%;margin:auto"}
```{r}
#| echo: true
#| warning: false
#| message: false
#| fig-cap: "Transmission network built using the netplot R package"
#| fig-align: center
#| fig-format: retina
#| fig-width: 8
#| fig-height: 8
#| code-fold: true
#| label: fig-epiworldR-2
sir <- ModelSIR(
name = "COVID-19",
prevalence = .01,
transmission_rate = .5,
recovery_rate = .5
) |>
# Adding a Small world population
agents_smallworld(n = 500, k = 10, d = FALSE, p = .01) |>
# Running the model for 50 days
verbose_off() |>
run(ndays = 50, seed = 1912)
## Transmission network
net <- get_transmissions(sir)
## Plotting
library(netplot)
library(igraph)
x <- graph_from_edgelist(as.matrix(net[,2:3]) + 1)
nplot(x, edge.curvature = 0, edge.color = "gray", skip.vertex=TRUE)
```
:::
## Schedule
Thank you for joining the epiworldR workshop at the Sunbelt 2023 conference. Our schedule for today is as follows:
- Setup (10 min)
- Part 1: Basic modeling (50 min)
- Break (10 min)
- Part 2a: Social Network Analysis (30 min)
- Part 2b: Adding multiple diseases & tools (30 min)
- Break (10 min)
- Part 3: Multiple runs (40 min)
You are welcome to use your personal computer, but we also have an online RStudio server available for you to use.[^noteposit]
[^noteposit]: Please note that the online RStudio server and your data stored in it will be available for two weeks after the workshop. After that, the server will be shut down and all data will be deleted. If you would like to keep your data, please download it before the server is shut down.
## **Installation**
You can install the development version of epiworldR from [GitHub](https://github.com/UofUEpiBio/epiworldR) with:
```{r}
#| eval: false
# install.packages("devtools")
devtools::install_github("UofUEpiBio/epiworldR")
```
## Agent-Based Modeling
Agent-based modeling (ABM) is a powerful computational approach that enables the simulation and analysis of complex systems by representing individual agents and their interactions within an environment. ABM provides a bottom-up perspective, allowing for the examination of emergent phenomena arising from the collective behavior of autonomous agents. By capturing the heterogeneity, autonomy, and adaptive nature of agents, ABM offers a versatile tool for investigating various domains, including social sciences, economics, biology, and epidemiology, offering valuable insights into the dynamics and patterns that emerge from the interactions of individual entities within a larger system.
## Terminology
epiworldR focuses heavily on epidemiological applications to social networking. Below are some common terms that will be used throughout.
SEIR, SIR, SIS, etc.:\
These are epidemiological models that are used to analyze the spread and dynamics of diseases in a population. These models are a combination or selection of the states susceptible, exposed, infected, and/or recovered, in which all individuals in a population can be categorized in.
SEIR connected (SEIRCONN), SIR connected (SIRCONN), etc.:\
These are epidemiological models that are similar to their above counterparts (SEIR, SIR, etc.), but with the assumption that each individual agent is connected to all other agents.
Reproductive number:\
The average number of secondary transmissions from one infected person. For example, a reproductive number of 2.0 indicates that one infected person transmits the disease to two other people in the population on average.
Incidence:\
The the occurrence of new cases of disease or injury in a population over a specified period of time. Specifically, daily incidence is computed in epiworldR.
## About the instructors
Dr. George G. Vega Yon is a Research Assistant Professor of Epidemiology at the Department of Internal Medicine at the University of Utah.
Derek S. Meyer is a Research Assistant and M.Stat. student in Biostatistics at the Department of Internal Medicine at the University of Utah.