This function defines settings for outbreaker. 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)

# S3 method for outbreaker_config
print(x, ...)

## Arguments

... further arguments to be passed to other methods an optional list of data items as returned by outbreaker_data; if provided, this allows for further checks of the outbreaker setings. an outbreaker_config object as returned by create_config.

## Details

Acceptables arguments for ... are:

init_tree

the tree used to initialize the MCMC. Can be either a character string indicating how this tree should be computed, or a vector of integers corresponding to the tree itself, where the i-th value corresponds to the index of the ancestor of 'i' (i.e., init.tree[i] is the ancestor of case i). Accepted character strings are "seqTrack" (uses seqTrack algorithm to generate the initial tree - see function seqTrack in the package adegenet), "random" (ancestor randomly selected from preceding cases), and "star" (all cases coalesce to the first case). Note that for SeqTrack, all cases should have been sequenced.

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_kappa

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

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_mu

initial value for the mutation rates

init_pi

initial value for the reporting probability

init_eps

initial value for the contact reporting coverage

init_lambda

initial value for the non-infectious contact rate

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_mu

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

move_pi

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

move_eps

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

move_lambda

a logical indicating whether the non-infectious contact rate should be estimated ('moved' in the MCMC), or not at 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_pi

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

n_iter

the number of iterations of the MCMC

sample_every

the frequency at which MCMC samples are retained for the output

sd_mu

the standard deviation for the Normal proposal for the mutation rates

sd_pi

the standard deviation for the Normal proposal for the reporting probability

sd_eps

the standard deviation for the Normal proposal for the contact reporting coverage

sd_lambda

the standard deviation for the Normal proposal for the non-infectious contact rate

prop_alpha_move

the proportion of ancestries to move at each iteration of the MCMC

prop_t_inf_move

the proportion of infection dates to move at each iteration of the MCMC

batch_size

the size of the batch of random number pre-generated

paranoid

a logical indicating if the paranoid mode should be used; this mode is used for performing additional tests during outbreaker; it makes computations substantially slower and is mostly used for debugging purposes.

min_date

earliest infection date possible, expressed as days since the first sampling

max_kappa

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

prior_mu

a numeric value indicating the rate of the exponential prior for the mutation rate 'mu'

prior_pi

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

prior_eps

a numeric vector of length 2 indicating the first and second parameter of the beta prior for the contact reporting coverage 'eps'

prior_lambda

a numeric vector of length 2 indicating the first and second parameter of the beta prior for the non-infectious contact rate 'lambda'

ctd_directed

a logical indicating if the contact tracing data is directed or not. If yes, the first column represents the infector and the second column the infectee. If ctd is provided as an epicontacts objects, directionality will be taken from there.

pb

a logical indicating if a progress bar should be displayed

outbreaker_data to check and process data for outbreaker

## Examples

## see default settings
create_config()#>
#>
#>  ///// outbreaker settings ///
#>
#> class: outbreaker_config list
#> number of items: 37
#>
#> /// initialisation //
#>   init_tree     init_mu  init_kappa     init_pi    init_eps init_lambda
#>    seqTrack       1e-04           1         0.9         0.5        0.05
#>
#> /// movements //
#>      move_alpha move_swap_cases      move_t_inf         move_mu      move_kappa
#>            TRUE            TRUE            TRUE            TRUE            TRUE
#>         move_pi        move_eps     move_lambda prop_alpha_move prop_t_inf_move
#>            TRUE            TRUE            TRUE            0.25             0.2
#>           sd_mu           sd_pi          sd_eps       sd_lambda
#>           1e-04             0.1             0.1            0.05
#>
#> /// chains //
#>       n_iter sample_every
#>        10000           50
#>
#> /// priors //
#>      prior_mu     prior_pi1     prior_pi2    prior_eps1    prior_eps2
#>             1            10             1             1             1
#> prior_lambda1 prior_lambda2
#>             1             1
#>
#> /// imported cases //
#>         find_import       n_iter_import sample_every_import   outlier_threshold
#>                TRUE                5000                  50                   5
#>
#> /// other settings //
#>     paranoid     min_date    max_kappa ctd_directed           pb
#>        FALSE          -10            5        FALSE        FALSE
## change defaults
create_config(move_alpha = FALSE, n_iter = 2e5, sample_every = 1000)#>
#>
#>  ///// outbreaker settings ///
#>
#> class: outbreaker_config list
#> number of items: 37
#>
#> /// initialisation //
#>   init_tree     init_mu  init_kappa     init_pi    init_eps init_lambda
#>    seqTrack       1e-04           1         0.9         0.5        0.05
#>
#> /// movements //
#>      move_alpha move_swap_cases      move_t_inf         move_mu      move_kappa
#>           FALSE            TRUE            TRUE            TRUE            TRUE
#>         move_pi        move_eps     move_lambda prop_alpha_move prop_t_inf_move
#>            TRUE            TRUE            TRUE            0.25             0.2
#>           sd_mu           sd_pi          sd_eps       sd_lambda
#>           1e-04             0.1             0.1            0.05
#>
#> /// chains //
#>       n_iter sample_every
#>        2e+05         1000
#>
#> /// priors //
#>      prior_mu     prior_pi1     prior_pi2    prior_eps1    prior_eps2
#>             1            10             1             1             1
#> prior_lambda1 prior_lambda2
#>             1             1
#>
#> /// imported cases //
#>         find_import       n_iter_import sample_every_import   outlier_threshold
#>                TRUE                5000                  50                   5
#>
#> /// other settings //
#>     paranoid     min_date    max_kappa ctd_directed           pb
#>        FALSE          -10            5        FALSE        FALSE