estimate_risk_spread {epiflows} | R Documentation |
Travel-related disease cases spreaded to other locations from an infectious location
Description
Calculates the mean and 95% confidence interval of the estimated number of
disease cases that could potentially seed a disease outbreak in the locations
they are travelling to, comprising exportations (infected residents of the infectious
location travelling abroad during the incubation or infectious period), and
importations (international tourists infected by the disease during
their stay in the infectious location and returning to their home location).
The mean and 95% confidence intervals are obtained by numerically sampling
n_sim
times from the incubation and infectious period distributions.
If parameter return_all_simulations
is set to TRUE
, the function returns all simulations
for each location.
Usage
estimate_risk_spread(...)
## Default S3 method:
estimate_risk_spread(
location_code = character(0),
location_population = numeric(0),
num_cases_time_window = numeric(0),
first_date_cases = character(0),
last_date_cases = character(0),
num_travellers_to_other_locations = numeric(0),
num_travellers_from_other_locations = numeric(0),
avg_length_stay_days = numeric(0),
r_incubation = function(n) {
},
r_infectious = function(n) {
},
n_sim = 1000,
return_all_simulations = FALSE,
...
)
## S3 method for class 'epiflows'
estimate_risk_spread(
x,
location_code = character(0),
r_incubation = function(n) {
},
r_infectious = function(n) {
},
n_sim = 1000,
return_all_simulations = FALSE,
...
)
Arguments
... |
Arguments passed onto the default method. |
location_code |
a character string denoting the infectious location code |
location_population |
population of the infectious location |
num_cases_time_window |
cumulative number of cases in infectious location in time window |
first_date_cases |
string with the date of the first disease case in infectious location ("YYYY-MM-DD") |
last_date_cases |
string with the date of the last disease case in infectious location ("YYYY-MM-DD") |
num_travellers_to_other_locations |
number of travellers from the infectious location visiting other locations (T_D) |
num_travellers_from_other_locations |
number of travellers from other locations visiting the infectious location (T_O) |
avg_length_stay_days |
average length of stay in days of travellers from other locations visiting the infectious location. This can be a common number for all locations or a vector with different numbers for each location |
r_incubation |
a function with a single argument |
r_infectious |
a function with a single argument |
n_sim |
number of simulations from the incubation and infectious distributions |
return_all_simulations |
logical value indicating whether the returned object is a data frame with all simulations
( |
x |
an epiflows object |
Value
if return_all_simulations
is TRUE
, data frame with all simulations. If return_all_simulations
is FALSE
,
data frame with the mean and lower and upper limits of a 95% confidence interval of the number
of cases spread to each location
Author(s)
Paula Moraga, Zhian Kamvar (epiflows class implementation)
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: doi:10.2807/1560-7917.ES.2017.22.28.30572
See Also
Construction of epiflows object: make_epiflows()
Default variables used in the epiflows implementation: global_vars()
Access metadata from the epiflows object: get_vars()
Examples
## Using an epiflows object --------------------------------
data("YF_flows")
data("YF_locations")
ef <- make_epiflows(flows = YF_flows,
locations = YF_locations,
pop_size = "location_population",
duration_stay = "length_of_stay",
num_cases = "num_cases_time_window",
first_date = "first_date_cases",
last_date = "last_date_cases"
)
## functions generating incubation and infectious periods
incubation <- function(n) {
rlnorm(n, 1.46, 0.35)
}
infectious <- function(n) {
rnorm(n, 4.5, 1.5/1.96)
}
res <- estimate_risk_spread(ef,
location_code = "Espirito Santo",
r_incubation = incubation,
r_infectious = infectious,
n_sim = 1e5,
return_all_simulations = TRUE)
boxplot(res, las = 3)
## Using other data --------------------------------------------------
data(YF_Brazil)
indstate <- 1 # "Espirito Santo" (indstate = 1),
# "Minas Gerais" (indstate = 2),
# "Southeast Brazil" (indstate = 5)
res <- estimate_risk_spread(
location_code = YF_Brazil$states$location_code[indstate],
location_population = YF_Brazil$states$location_population[indstate],
num_cases_time_window = YF_Brazil$states$num_cases_time_window[indstate],
first_date_cases = YF_Brazil$states$first_date_cases[indstate],
last_date_cases = YF_Brazil$states$last_date_cases[indstate],
num_travellers_to_other_locations = YF_Brazil$T_D[indstate,],
num_travellers_from_other_locations = YF_Brazil$T_O[indstate,],
avg_length_stay_days = YF_Brazil$length_of_stay,
r_incubation = incubation,
r_infectious = infectious,
n_sim = 100000,
return_all_simulations = FALSE
)
head(res)