emcmc: Eruptive MCMC

Description Usage Arguments Author(s) Examples

Description

This is a variation on the tempering algorithm. It relies on alternative blocks of cold chains with blocks of very hot chains.

Usage

1
2
3
emcmc(f, param = list(x = 0), to.move = TRUE, n = 200,
  cold.block.size = 200, hot.block.size = 100, sd = 1, min.temp = 10,
  max.temp = 100)

Arguments

f

a function computing log-densities

param

a list of named parameters passed on to 'f'; parameters must be given their initial values

to.move

a logical or an integer vector indicating which parts of 'param' should be moved in the MCMC

n

a number of iterations for the eMCMC

cold.block.size

the size of cold blocks

hot.block.size

the size of hot blocks

sd

the standard deviation of the proposal normal distribution

min.temp

the maximum temperature to be used

max.temp

the maximum temperature to be used

Author(s)

Thibaut Jombart t.jombart@imperial.ac.uk

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
## try with a basic normal density
f1 <- function(x){dnorm(x, log=TRUE)}

## basic MCMC
mc1 <- metro(f1)
plot(mc1)

## eMCMC
emc1 <- emcmc(f1)
plot(emc1[[1]]) # all chains
plot(emc1[[2]]) # thinned

## try with a mixture of densities
fmix <- function(x){log(dnorm(x, mean=-5) +
                        dnorm(x, mean=5, sd=.5))}

plot(function(x) exp(fmix(x)), xlim=c(-10,10))
title("Target density")

## basic MCMC
mc2 <- metro(fmix, list(x=0), n=6e4)
plot(mc2)

## eMCMC
emc2 <- emcmc(fmix)
plot(emc2[[1]]) # all chains
plot(emc2[[2]]) # thinned

thibautjombart/fancysamplers documentation built on May 31, 2019, 9:56 a.m.