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.
create_config(..., data = NULL)
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
.
a list of config items to be processed (see description)
an optional list of data items as returned by
outbreaker_data
; if provided, this allows for further checks of
the outbreaker settings.
Initial version by Thibaut Jombart, rewritten by Alexis Robert (alexis.robert@lshtm.ac.uk)
Acceptable arguments for ... are:
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.
a character string indicating the method used to evaluate the spatial likelihood. Can be either "exponential" or "power-law".
a double indicating the spatial threshold for pre clustering; defaults to NULL.
a double indicating the temporal threshold for pre clustering; defaults to NULL.
a vector of integers indicating the initial values of kappa; defaults to 1.
initial value of the first spatial parameter (population).
initial value of the second spatial parameter (distance).
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
.
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
.
initial value for the reporting probability.
an integer indicating the number of iterations in the MCMC, including the burnin period.
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.
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.
a logical indicating whether the reporting probability should be estimated ('moved' in the MCMC), or not, all defaulting to TRUE.
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.
a logical indicating whether the first spatial parameter should be estimated ('moved' in the MCMC), or not, all defaulting to TRUE.
a logical indicating whether the second spatial parameter should be estimated ('moved' in the MCMC), or not, all defaulting to TRUE.
a logical indicating whether the movement to swap cases should be used, or not, all defaulting to TRUE.
the frequency at which MCMC samples are retained for the output.
the standard deviation for the Normal proposal for the reporting probability.
the standard deviation for the Normal proposal for the first spatial parameter.
the standard deviation for the Normal proposal for the second spatial parameter.
a logical indicating whether the import status of cases should be estimated.
a numeric value indicating the probability that should be used to compute the threshold when estimating the import status.
a logical indicating whether the threshold is an absolute or relative value, default to FALSE (absolute value).
a logical indicating whether to plot the comparison between the likelihoods of connection in the short run and the threshold.
Number of iterations of the first short run.
the frequency at which MCMC samples are retained for the output during the first run.
The number of iterations that should be removed when estimating import.
an integer indicating the largest number of generations between any two linked cases; defaults to 5.
a numeric vector of length 2 indicating the first and second parameter of the beta prior for the reporting probability 'pi'.
a numeric vector of length 2 indicating the first and second parameter of the uniform prior for the first spatial parameter 'a'.
a numeric vector of length 2 indicating the first and second parameter of the uniform prior for the second spatial parameter 'b'.
Logical, should the number of iteration be printed.
outbreaker_data
to check and process data for outbreaker
## see default settings
create_config()
## change defaults
create_config(move_alpha = FALSE, n_iter = 2e5, sample_every = 1000)
Run the code above in your browser using DataLab