/AdaptiveMetropolis

Adaptive Metropolis Package for R

Primary LanguageR

AdaptiveMetropolis

Build Status

An R package implementing a series of adaptive metropolis hastings Markov chain algorithms.

Written originally as a project to satisfy the assesment requirements of the Statistical Computing module from the Oxford-Warwick Statistics Programme EPSRC Center for Doctoral Traning.

Install

The devtools package is required to install development versions of this package with the following command:

devtools::install_github("tom-jin/AdaptiveMetropolis")

Demo

Start with a Normal(0,1) distribution explore a Unif(0,100) distribution. The variance of the proposal distribution is adapted to improve mixing whilst exploring the target distribution. The first 1000 samples are considered a burn in period and discarded.

data <- AM(function(x) {dnorm(x, 0,100)}, 5000, 0, 1)
plot(data)