Reads in all MCMC chains for theta and infection histories from the specified directory matching files ending "_chain.csv", adding in the total number of infections.

load_mcmc_chains(
  location = getwd(),
  par_tab = NULL,
  estimated_only = FALSE,
  thin = 1,
  burnin = 0,
  convert_mcmc = FALSE,
  verbose = TRUE
)

Arguments

location

Character string path to the directory containing the chain files. Defaults to `getwd()`.

par_tab

Data frame; optional model control table used to select estimated parameters. Defaults to `NULL`.

estimated_only

if TRUE, only returns free model parameters (`par_tab$fixed == 0`) when `par_tab` is supplied. Defaults to `FALSE` for this wrapper.

thin

Integer; keeps every `thin`th saved MCMC sample. Defaults to `1` (no thinning).

burnin

Integer; discards samples with `samp_no <= burnin`. Defaults to `0`.

convert_mcmc

if TRUE, converts the returned parameter chains to `coda::mcmc` objects. Defaults to `FALSE`.

verbose

Logical; whether to print progress messages.

Value

A list with four entries: `theta_chain` and `inf_chain` contain the combined parameter and infection-history chains; `theta_list_chains` and `inf_list_chains` contain the corresponding chains separately. If `convert_mcmc = TRUE`, the parameter chains are converted to `coda::mcmc` objects; the infection-history chains remain data tables.

Examples

if (FALSE) load_mcmc_chains(par_tab=par_tab, estimated_only=TRUE,thin=10,burnin=5000,convert_mcmc=TRUE) # \dontrun{}