-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathREADME.Rmd
133 lines (93 loc) · 5.79 KB
/
README.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
---
output: github_document
---
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/epiflows)](https://cran.r-project.org/package=epiflows)
[![Travis-CI Build Status](https://travis-ci.org/reconhub/epiflows.svg?branch=master)](https://travis-ci.org/reconhub/epiflows)
[![codecov](https://codecov.io/gh/reconhub/epiflows/branch/master/graph/badge.svg)](https://codecov.io/gh/reconhub/epiflows)
[![DOI](https://zenodo.org/badge/102121281.svg)](https://zenodo.org/badge/latestdoi/102121281)
# Welcome to the *epiflows* package!
`epiflows` is a package for predicting and visualising spread of infectious diseases based on flows between geographical locations, e.g., countries.
`epiflows` provides functions for calculating spread estimates, handling flow data, and visualization.
## Installing the package
<!-- To install the current stable, CRAN version of the package, type: -->
<!-- ```{r install, eval = FALSE} -->
<!-- install.packages("epiflows") -->
<!-- ``` -->
<!-- To benefit from the latest features and bug fixes, install the development, *github* version of the package using: -->
Currently, epiflows is a work in progress and can be installed from github using
the *remotes*, *ghit*, or *devtools* package:
```{r install2, eval = FALSE}
if (!require("remotes")) install.packages("remotes", repos = "https://cloud.rstudio.org")
remotes::install_github("reconhub/epiflows")
```
## Citation
A publication describing this package has been submitted to F1000 research and
can be cited as:
> Moraga P, Dorigatti I, Kamvar ZN, Piatkowski P, Toikkanen SE, Nagraj V,
> Donnelly CA, and Jombart T epiflows: an R package for risk assessment of
> travel-related spread of disease [version 1; referees: awaiting peer review].
> F1000Research 2018, 7:1374 ([doi: 10.12688/f1000research.16032.1](https://doi.org/10.12688/f1000research.16032.1))
# What does it do?
The main features of the package include:
## Estimation of risk
* `estimate_risk_spread()`: calculate estimates (point estimate and 95% CI) for disease spread from flow data
### Example
Estimating the number of new cases flowing to other countries from Espirito Santo, Brazil (Dorigatti *et al.*, 2017).
```{r the_estimate}
library("epiflows")
library("ggplot2")
data("Brazil_epiflows")
print(Brazil_epiflows)
set.seed(2018-07-25)
res <- estimate_risk_spread(Brazil_epiflows,
location_code = "Espirito Santo",
r_incubation = function(n) rlnorm(n, 1.46, 0.35),
r_infectious = function(n) rnorm(n, 4.5, 1.5/1.96),
n_sim = 1e5
)
res
res$location <- rownames(res)
ggplot(res, aes(x = mean_cases, y = location)) +
geom_point(size = 2) +
geom_errorbarh(aes(xmin = lower_limit_95CI, xmax = upper_limit_95CI), height = .25) +
theme_bw(base_size = 12, base_family = "Helvetica") +
ggtitle("Yellow Fever Spread from Espirito Santo, Brazil") +
xlab("Number of cases") +
xlim(c(0, NA))
```
## Data structure to store flows and metadata
* `epiflows`: an S3 class for storing flow data, as well as country metadata.
This class contains two data frames containing flows and location metadata based on the `epicontacts` class from the [epicontacts pacakge](http://www.repidemicsconsortium.org/epicontacts/).
* `make_epiflows()`: a constructor for `epiflows` from either a pair of data frames or inflows and outflows and location data frame.
* `add_coordinates()`: add latitude/longitude to the location data in an `epiflows` object using `ggmap::geocode()`
## Basic methods
* `x[j = myLocations]`: subset an `epiflows` object to location(s) *myLocations*
* `plot()`: plot flows from an `epiflows` object on a *leaflet* world map
* `print()`: print summary for an `epiflows` object
## Global variables
These are variables that `estimate_risk_spread()` understands from the epiflows
object. These represent keys that have values mapping to column names in your
locations metadata.
* `global_vars()`: view, set, and reset global variables for epiflows
* `get_vars()`: access variables from the locations metadata
* `set_vars()`: map variables to columns in the locations metadata
## Accessors
* `get_flows()`: return flow data
* `get_locations()`: return metadata for all locations
* `get_coordinates()`: return coordinates for each location (if provided)
* `get_id()`: return a vector of location identifiers
* `get_n()`: return the number of cases per flow
* `get_pop_size()`: return the population size for each location (if provided)
# Resources
## Vignettes
An overview and examples of *epiflows* are provided in the vignettes:
1. A Brief Introduction to epiflows: `vignette("introduction", package = "epiflows")`
2. Constructing epiflows objects: `vignette("epiflows-class", package = "epiflows")`
## Getting help online
Bug reports and feature requests should be posted on *github* using the [*issue*](http://github.com/reconhub/epiflows/issues) system. All other questions should be posted on the **RECON forum**: <br>
[http://www.repidemicsconsortium.org/forum/](http://www.repidemicsconsortium.org/forum/)
Contributions are welcome via **pull requests**.
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
# References
Dorigatti I, Hamlet A, Aguas R, Cattarino L, Cori A, Donnelly CA, Garske T, Imai N, Ferguson NM. International risk of yellow fever spread from the ongoing outbreak in Brazil, December 2016 to May 2017. Euro Surveill. 2017;22(28):pii=30572. DOI: [10.2807/1560-7917.ES.2017.22.28.30572](https://doi.org/10.2807/1560-7917.ES.2017.22.28.30572)