create_config {o2geosocial}R Documentation

Set and check parameter settings

Description

This function defines settings. It takes a list of named items as input, performs various checks, set defaults where arguments are missing, and return a correct list of settings. If no input is given, it returns the default settings.

Usage

create_config(..., data = NULL)

Arguments

...

a list of config items to be processed (see description)

data

an optional list of data items as returned by outbreaker_data; if provided, this allows for further checks of the outbreaker settings.

Details

Acceptable arguments for ... are:

init_tree

the tree used to initialize the MCMC. It can be a vector of integers corresponding to the tree itself, where the i-th value corresponds to the index of case i. Otherwise, it should be defined as the character string "star" and the function create_config() will generate the initial tree.

spatial_method

a character string indicating the method used to evaluate the spatial likelihood. Can be either "exponential" or "power-law".

gamma

a double indicating the spatial threshold for pre clustering; defaults to NULL.

delta

a double indicating the temporal threshold for pre clustering; defaults to NULL.

init_kappa

a vector of integers indicating the initial values of kappa; defaults to 1.

init_a

initial value of the first spatial parameter (population).

init_b

initial value of the second spatial parameter (distance).

init_alpha

a vector of integers indicating the initial values of alpha, where the i-th value indicates the ancestor of case 'i'; defaults to NULL, in which ancestries are defined from init_tree.

init_t_inf

a vector of integers indicating the initial values of t_inf, i.e. dates of infection; defaults to NULL, in which case the most likely t_inf will be determined from the delay to reporting/symptoms distribution, and the dates of reporting/symptoms, provided in data.

init_pi

initial value for the reporting probability.

n_iter

an integer indicating the number of iterations in the MCMC, including the burnin period.

move_alpha

a vector of logicals indicating, for each case, if the ancestry should be estimated ('moved' in the MCMC), or not, defaulting to TRUE; the vector is recycled if needed.

move_t_inf

a vector of logicals indicating, for each case, if the dates of infection should be estimated ('moved' in the MCMC), or not, defaulting to TRUE; the vector is recycled if needed.

move_pi

a logical indicating whether the reporting probability should be estimated ('moved' in the MCMC), or not, all defaulting to TRUE.

move_kappa

a logical indicating whether the number of generations between two successive cases should be estimated ('moved' in the MCMC), or not, all defaulting to TRUE.

move_a

a logical indicating whether the first spatial parameter should be estimated ('moved' in the MCMC), or not, all defaulting to TRUE.

move_b

a logical indicating whether the second spatial parameter should be estimated ('moved' in the MCMC), or not, all defaulting to TRUE.

move_swap_cases

a logical indicating whether the movement to swap cases should be used, or not, all defaulting to TRUE.

sample_every

the frequency at which MCMC samples are retained for the output.

sd_pi

the standard deviation for the Normal proposal for the reporting probability.

sd_a

the standard deviation for the Normal proposal for the first spatial parameter.

sd_b

the standard deviation for the Normal proposal for the second spatial parameter.

find_import

a logical indicating whether the import status of cases should be estimated.

outlier_threshold

a numeric value indicating the probability that should be used to compute the threshold when estimating the import status.

outlier_relative

a logical indicating whether the threshold is an absolute or relative value, default to FALSE (absolute value).

outlier_plot

a logical indicating whether to plot the comparison between the likelihoods of connection in the short run and the threshold.

n_iter_import

Number of iterations of the first short run.

sample_every_import

the frequency at which MCMC samples are retained for the output during the first run.

burnin

The number of iterations that should be removed when estimating import.

max_kappa

an integer indicating the largest number of generations between any two linked cases; defaults to 5.

prior_pi

a numeric vector of length 2 indicating the first and second parameter of the beta prior for the reporting probability 'pi'.

prior_a

a numeric vector of length 2 indicating the first and second parameter of the uniform prior for the first spatial parameter 'a'.

prior_b

a numeric vector of length 2 indicating the first and second parameter of the uniform prior for the second spatial parameter 'b'.

verbatim

Logical, should the number of iteration be printed.

Value

A named list containing the value of each elements listed in the 'Details' section. This list describes the settings of the outbreaker() function. The class of this list is set to outbreaker_config.

Author(s)

Initial version by Thibaut Jombart, rewritten by Alexis Robert (alexis.robert@lshtm.ac.uk)

See Also

outbreaker_data to check and process data for outbreaker

Examples

## see default settings
create_config()

## change defaults
create_config(move_alpha = FALSE, n_iter = 2e5, sample_every = 1000)




[Package o2geosocial version 1.1.3 Index]