MCMC.add.samples {adaptMCMC} | R Documentation |
Add samples to an existing chain.
Description
Add samples to an existing chain produced by MCMC
or MCMC.parallel
.
Usage
MCMC.add.samples(MCMC.object, n.update, ...)
Arguments
MCMC.object |
a list produced by |
n.update |
number of additional samples. |
... |
further arguments passed to |
Details
Only objects generated with the option list = TRUE
can be
updated.
A list of chains produced by MCMC.parallel
can be
updated. However, the calculations are not performed in parallel
(i.e. only a single CPU is used).
Value
A updated version of MCMC.object
.
Author(s)
Andreas Scheidegger, andreas.scheidegger@eawag.ch or scheidegger.a@gmail.com
See Also
Examples
## ----------------------
## 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, list=TRUE)
## ----------------------
## add 200 to the existing chain
samp <- MCMC.add.samples(samp, n.update=200)
str(samp)
[Package adaptMCMC version 1.5 Index]