mcarray.object: Objects for representing MCMC output

mcarray.objectR Documentation

Objects for representing MCMC output

Description

An mcarray object is used by the jags.samples function to represent monitored output from a JAGS model. It is a tagged array with tags "value", "iteration" and "chain".

Usage

## S3 method for class 'mcarray'
summary(object, FUN, ...)
## S3 method for class 'mcarray'
print(x, ...)
## S3 method for class 'mcarray'
as.mcmc.list(x, na.rm=TRUE, ...)

Arguments

object, x

an mcarray object

FUN

a function to be used to generate summary statistics

na.rm

indicates whether elements with missing values should be removed

...

additional arguments to the call

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.

Objects of class mcarray are tagged arrays with a limited set of supported tags:

"value"

dimensions corresponding to the dimension of the object in the JAGS model

"iteration"

dimension corresponding to the evolution of the Markov chain over iterations

"chain"

dimension corresponding to replication of the Markov chain over parallel chains

There can be multiple dimensions with tag "value" but at most one with tag "iteration" and at most one with tag "chain".

Value

The summary method for mcarray objects collapses the object over "chain" and "iteration" dimensions leaving "value" dimensions.

The print method prints the mean, collapsing over "chain" and "iteration" dimensions. It also includes information about the "stat" and "summary" of the JAGS monitor and the size of the collapsed dimensions.

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.

Author(s)

Martyn Plummer

See Also

collapse


rjags documentation built on Nov. 21, 2026, 9:10 a.m.