mtrace: Diagnostics of migrate-n MCMC chains

View source: R/mtraceR.R

mtraceR Documentation

Diagnostics of migrate-n MCMC chains

Description

mtrace parses migrate-n output file (bayesallfile) and calculates the Effective Sample Size (ESS) for each locus. If save2dis=TRUE these are also saved to disk together with a PDF with the trace and density plots for each locus and each replicate.

Usage

mtrace(
  heating = TRUE,
  nchain = 4,
  burn.in = 0.1,
  trim_params = TRUE,
  thin = 10,
  bayesallfile = NULL,
  fixcorruptBayesallfile = FALSE,
  dir.in = NULL,
  dir.out = NULL,
  save2disk = TRUE
)

Arguments

heating

Whether heating is used: (TRUE or FALSE)

nchain

Number of chains if heating=TRUE

burn.in

Length of burn-in as proportion of MCMC (default: 0.1)

trim_params

Whether trim data to estimated parameters (i.e. theta and M. default: TRUE)

thin

the thinning interval of recorded steps of trace plots

bayesallfile

The name of the bayesallfile (default: NULL)

fixcorruptBayesallfile

Whether the user believe the bayesallfile is corrupted and wants to attempt to fix it. Default FALSE for back compatibility.

dir.in

The local folder containing migrate-n output files (default: NULL)

dir.out

The local path to store the results. If NULL (default) then dir.out=dir.in

save2disk

Whether to save results to disk (default: TRUE)

Details

If there is more than 1 replicate, mtrace returns also Gelman and Rubin's convergence diagnostic for each locus. When save2dis=TRUE relevant diagnostic plots are also saved as a separate PDF.

When no bayesallfile name and directory are provided (default), the output file is selected with an interactive window. Alternatively, when the directory path is provided with dir.in and bayesallfile=NULL, the latter is automatically set to "bayesallfile.gz". If the name of the file is provided, but dir.in=NULL, the directory path is selected interactively.

If the analysed was interrupted, or recovered, it is possible that mtrace will throw an error. In such cases, it is possible to attempt repairing the file by setting fixcorruptBayesallfile=TRUE. See further information on cleanBayesAll.

If dir.out=NULL (default) then dir.out=dir.in.

Value

a list with the ESS for each locus, a summary of ESS across all loci and Gelman's diagnostic if more replicates were run. See details for additional outputs when save2dis=TRUE.


carlopacioni/mtraceR documentation built on Nov. 3, 2023, 4:30 a.m.