convert.to.coda: Converts chain(s) into 'coda' objects.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/Adaptive_MCMC.R

Description

Converts chain(s) produced by MCMC or MCMC.parallel into coda objects.

Usage

1

Arguments

sample

output of MCMC or MCMC.parallel.

Details

Converts chain(s) produced by MCMC or MCMC.parallel so that they can be used with functions of the coda package.

Value

An object of the class mcmc or mcmc.list.

Author(s)

Andreas Scheidegger, andreas.scheidegger@eawag.ch or scheidegger.a@gmail.com

See Also

MCMC, mcmc, mcmc.list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## ----------------------
## Banana shaped distribution

## log-pdf to sample from
p.log <- function(x) {
  B <- 0.03                              # controls 'bananacity'
  -x[1]^2/200 - 1/2*(x[2]+B*x[1]^2-100*B)^2
}


## ----------------------
## generate 200  samples

samp <- MCMC(p.log, n=200, init=c(0, 1), scale=c(1, 0.1),
               adapt=TRUE, acc.rate=0.234)


## ----------------------
## convert in object of class 'mcmc'
samp.coda <- convert.to.coda(samp)

class(samp.coda)

## ----------------------
## use functions of package 'coda'

require(coda)

plot(samp.coda)
cumuplot(samp.coda)

adaptMCMC documentation built on March 29, 2021, 9:11 a.m.