Skip to contents

Generic function to convert Markov Chain Monte Carlo (MCMC) output to coda::mcmc or coda::mcmc.list format.

Usage

as_mcmc(x, ...)

# S3 method for class 'rjuliabugs'
as_mcmc(x, ...)

# S3 method for class 'array'
as_mcmc(x, ...)

Arguments

x

An object to convert (e.g., a rjuliabugs object or a 3D array).

...

Further arguments passed to specific methods.

Value

An object of class mcmc, mcmc.list, or a rjuliabugs object with updated params.

An object of class "rjuliabugs" (a named list) with the following elements:

params

Posterior samples converted to coda::mcmc if a single chain, or coda::mcmc.list if multiple chains.

name

The name of the Julia sampler object (unchanged).

sampler

The sampler object returned by AbstractMCMC.sample in Julia (unchanged).

n_threads

Number of Julia threads detected (unchanged).

mcmc

MCMC configuration parameters; posterior_type is updated to "mcmc".

control

Control options passed to and used by the sampler (unchanged).

Returns posterior samples converted to coda::mcmc if the array has one chain, or coda::mcmc.list if multiple chains. Input must be a 3D array (iterations × chains × parameters). Each column corresponds to a parameter, and each row corresponds to an iteration.