# NOT RUN {
## a 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
}
## use stretch move
res1 <- MCMCEnsemble(p.log, lower.inits=c(a=0, b=0), upper.inits=c(a=1, b=1),
max.iter=3000, n.walkers=10, method="stretch")
str(res1)
## use stretch move, return samples as 'coda' object
res2 <- MCMCEnsemble(p.log, lower.inits=c(a=0, b=0), upper.inits=c(a=1, b=1),
max.iter=3000, n.walkers=10, method="stretch",
coda=TRUE)
summary(res2$samples)
plot(res2$samples)
## use different evolution move, return samples as 'coda' object
res3 <- MCMCEnsemble(p.log, lower.inits=c(a=0, b=0), upper.inits=c(a=1, b=1),
max.iter=3000, n.walkers=10,
method="differential.evolution", coda=TRUE)
summary(res3$samples)
plot(res3$samples)
# }
Run the code above in your browser using DataLab