Skip to contents

Extracts parallel chains from an MCMC object to create an mcmc.list object for use with coda diagnostic tools.

Usage

as_coda(from, ...)

# S4 method for MCMC
as_coda(from, chains = 1)

Arguments

from

from An object to be coerced.

...

Currently not used.

chains

An integer specifying the number of parallel chains (defaults to \(1\)).

Value

An coda::mcmc.list object.

Author

A. Philippe, M.-A. Vibet

Examples

## Load coda
library(coda)

## Coerce to MCMC
eve <- as_events(events, calendar = "CE", iteration = 1)

## Coerce to coda
mc <- as_coda(eve[, 1:2], chains = 3)
plot(mc)


## Autocorrelation
autocorr.plot(mc)




## Gelman-Rubin diagnostic
## The multivariate criterion can not be evaluated when a phase
## contains only one date. This induces colinearity problems.
gelman.diag(mc)
#> Potential scale reduction factors:
#> 
#>    Point est. Upper C.I.
#> E1          1          1
#> E2          1          1
#> 
#> Multivariate psrf
#> 
#> 1
gelman.plot(mc)