Searches the given working directory for MCMC outputs from serosolver matching "_chain.csv", reads these in, subsets for burn in and thinning, and formats as both lists and a combined data frame.

load_theta_chains(
  location = getwd(),
  par_tab = NULL,
  estimated_only = TRUE,
  thin = 1,
  burnin = 0,
  convert_mcmc = TRUE,
  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 and `par_tab` is supplied, only returns parameters with `par_tab$fixed == 0`.

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

Logical; if TRUE, also converts the chains to `coda::mcmc` or `coda::mcmc.list` objects. Defaults to `TRUE`.

verbose

Logical; whether to print progress messages.

Value

A list with two entries: `list`, containing the chains separately, and `chain`, containing the combined chains with a `chain_no` column. If `convert_mcmc = TRUE`, these entries are converted to `coda::mcmc.list` and `coda::mcmc` objects.

Examples

if (FALSE) load_theta_chains(location="mcmc_chains", par_tab=par_tab, estimated_only=TRUE,thin=10,burnin=5000,convert_mcmc=TRUE) # \dontrun{}