outbreaker: outbreaker: main function for reconstructing disease...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/outbreaker.R

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

1
2
3
4
5
6
7
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 outbreaker_data

config

a set of settings as returned by create_config

priors

a set of log-prior functions as returned by custom_priors

likelihoods

a set of log-likelihood functions as returned by custom_likelihoods

moves

a set of movement functions as returned by custom_moves

Value

A data frame of n_iter / sample_every rows (as defined in the functioncreate_config()). For each row, the data frame contains:

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

Examples

 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
## 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)

o2geosocial documentation built on Sept. 11, 2021, 9:07 a.m.