MCMCresult {compareMCMCs} R Documentation

## R6 class to hold MCMC samples, timing results, and metrics

### Description

R6 class to hold MCMC samples, timing results, and metrics

R6 class to hold MCMC samples, timing results, and metrics

### Public fields

MCMC

Optional name for the MCMC method.

samples

Matrix of MCMC samples. Rows are for MCMC iterations. Columns are for parameters. Columns must be named.

times

A list of times including elements for setup, burnin, postburnin (sampling for recorded samples), and sampling (normally burnin + postburnin). Each list element should be a single numeric value.

metrics

A list of MCMC performance metrics such as effective sample size (ESS), efficiency, mean, median, and credible interval boundaries. metrics ' is organized as a list with three elements: byMCMC, byParameter, and other ' (currently unused).

byMCMC is for metrics with one number for an entire MCMC sample (as opposed to one number for each parameter). byMCMC is a data frame with one row and columns for MCMC name each metric. These would be metrics where there is a single

byParameter is for metrics with one number for each parameter in each MCMC sample. byParameter is a data.frame with one row for each MCMC-x-parameter combination and columns for MCMC method, parameter name, and each metric. There will only be one MCMC method name (all entries in the MCMC column will be the same).

The MCMC columns in byMCMC and byParameter are useful for combining metrics from a list of MCMCresult objects, such as done by combineMetrics, and for retaining MCMC method labels if these data.frames are copied and used outside of an MCMCresult object.

other is simply an arbitrary list. This allows arbitrarily structured metrics to be saved.

Elements of metrics are normally populated by addMetrics or compareMCMCs (which calls addMetrics).

sessionInfo

Result of running sessionInfo() prior to calling an MCMC engine, if requested.

### Methods

#### Method new()

Create a new MCMCresult object.

##### Arguments
samples

A data.frame with MCMC output.

NULL

#### Method rename()

Change the MCMC method name from oldName to newName

##### Arguments
silent

logical indicating whether to emit warnings

##### Details

This function does nothing if metrics are already initialized. It does not clear metrics. See clearMetrics for information on how metrics are initialized.

##### Returns

logical indicating whether metrics is well-formed or not.

#### Method clearMetrics()

Clear (reset) byParameter and/or byMCMC metrics

##### Arguments
metricResult

A list with possible elements byParameter, byMCMC, and other. These are typically returned from a metric function called via addMetric. Each is combined with previous metrics already in the corresponding elements of metrics.

#### Method clone()

The objects of this class are cloneable with this method.

##### Usage
MCMCresult\$clone(deep = FALSE)
##### Arguments
deep

Whether to make a deep clone.

renameMCMC to change the name of an MCMC method throughout the structure of a list of MCMCresult objects.