R package that provides an implementation of the generic adaptive Monte Carlo Markov chain sampler proposed by Vihola (2011).
Switch branches/tags
Nothing to show
Clone or download
Latest commit e27f364 Jan 5, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
adaptMCMC use t-distribution as proposal Jan 5, 2018
LICENSE Initial commit Oct 28, 2013
README.md add plot to example Jan 5, 2018
test_adaptMCMC.r warnings -> errors Jan 5, 2018

README.md

adaptMCMC

R package that provides an implementation of the generic adaptive Monte Carlo Markov chain sampler proposed by Vihola (2011).

Getting started

library(adaptMCMC)

## ----------------------
## Define (non-normalized) log density

## 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 samples

## 1) non-adaptive sampling
samp.1 <- MCMC(p.log, n=200, init=c(0, 1), scale=c(1, 0.1),
               adapt=FALSE)

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


## ----------------------
## summarize results

str(samp.2)
summary(samp.2$samples)

## covariance of last jump distribution
samp.2$cov.jump

## plot chains and marginals
plot(convert.to.coda(samp.2))