Learn R Programming

rjags (version 4-8)

mcarray.object: Objects for representing MCMC output

Description

An mcarray object is used by the jags.samples function to represent MCMC output from a JAGS model. It is an array with named dimensions, for which the dimensions "iteration" and "chain" have a special status

Usage

# S3 method for mcarray
summary(object, FUN, …)
# S3 method for mcarray
print(x, …)
# S3 method for mcarray
as.mcmc.list(x, …)

Arguments

object,x

an mcarray object

FUN

a function to be used to generate summary statistics

additional arguments to the call

Value

The summary method for mcarray objects applies the given function to the array, marginalizing the "chain" and "iteration" dimensions.

The print method applies the summary function with FUN=mean.

The as.mcmc.list method coerces an mcarray to an mcmc.list object so that the diagnostics provided by the coda package can be applied to the MCMC output it represents.

Details

The coda package defines mcmc objects for representing output from an MCMC sampler, and mcmc.list for representing output from multiple parallel chains. These objects emphasize the time-series aspect of the MCMC output, but lose the original array structure of the variables they represent. The mcarray class attempts to rectify this by preserving the dimensions of the original node array defined in the JAGS model.