outbreaker {o2geosocial} | R Documentation |
outbreaker: main function for reconstructing disease outbreaks
Description
The function outbreaker
is the main function of the package. It runs
processes various inputs (data, configuration settings, custom priors,
likelihoods and movement functions) and explores the space of plausible
transmission trees of a densely sampled outbreaks.
Usage
outbreaker(
data = outbreaker_data(),
config = create_config(),
priors = custom_priors(),
likelihoods = custom_likelihoods(),
moves = custom_moves()
)
Arguments
data |
a list of named items containing input data as returned by
|
config |
a set of settings as returned by |
priors |
a set of log-prior functions as returned by
|
likelihoods |
a set of log-likelihood functions as returned by
|
moves |
a set of movement functions as returned by
|
Value
A data frame of n_iter / sample_every
rows (as defined in the functioncreate_config()
). For each row, the data frame contains:
-
post
: The posterior value of the transmission tree at this iteration. -
like
: The likelihood value of the transmission tree at this iteration. -
post
: The posterior value of the transmission tree at this iteration. -
a
: The estimate of the spatial parametera
at this iteration, -
a
: The estimate of the spatial parameterb
at this iteration, -
pi
: The estimate of the conditional report ratiopi
at this iteration, -
alpha_1 to alpha_N
: The infector of each case at this iteration. -
t_inf_1 to t_inf_N
: The infection date of each case at this iteration. -
kappa_1 to kappa_N
: The number of generation between each case and their infector at this iteration.
Author(s)
Initial version by Thibaut Jombart, rewritten by Alexis Robert (alexis.robert@lshtm.ac.uk)
See Also
outbreaker_data
to process input data, and
create_config
to process/set up parameters
-
outbreaker_data
: function to process input data -
create_config
: function to create default and customise configuration settings -
custom_priors
: function to specify customised prior functions -
custom_likelihoods
: function to specify customised likelihoods functions -
custom_moves
: function to create default and customise movement functions
Examples
## get data
data(toy_outbreak_short)
## run outbreaker
dt_cases <- toy_outbreak_short$cases
dt_cases <- dt_cases[order(dt_cases$Date), ]
dt_regions <- toy_outbreak_short$dt_regions
all_dist <- geosphere::distGeo(matrix(c(rep(dt_regions$long, nrow(dt_regions)),
rep(dt_regions$lat, nrow(dt_regions))),
ncol = 2),
matrix(c(rep(dt_regions$long, each = nrow(dt_regions)),
rep(dt_regions$lat, each = nrow(dt_regions))),
ncol = 2))
dist_mat <- matrix(all_dist/1000, nrow = nrow(dt_regions))
pop_vect <- dt_regions$population
names(pop_vect) <- rownames(dist_mat) <- colnames(dist_mat) <- dt_regions$region
data <- outbreaker_data(dates = dt_cases$Date, age_group = dt_cases$age_group,
region = dt_cases$Cens_tract, population = pop_vect,
distance = dist_mat, a_dens = toy_outbreak_short$age_contact,
f_dens = dgamma(x = 1:300, scale = 0.43, shape = 27),
w_dens = dnorm(x = 1:300, mean = 11.7, sd = 2.0))
out <- outbreaker(data = data, config = list(n_iter = 200, sample_every = 5,
n_iter_import = 100, sample_every_import = 5,
gamma = 100, delta = 30, burnin = 20))
plot(out)