hmmeantemp: Metropolis-Hastings with tempering steps for the mean mixture...

View source: R/hmmeantemp.R

hmmeantempR Documentation

Metropolis-Hastings with tempering steps for the mean mixture posterior model

Description

This function provides another toy illustration of the capabilities of a tempered random walk Metropolis-Hastings algorithm applied to the posterior distribution associated with a two-component normal mixture with only its means unknown (Chapter 7). It shows how a decrease in the temperature leads to a proper exploration of the target density surface, despite the existence of two well-separated modes.

Usage

hmmeantemp(dat, niter, var = 1, alpha = 1)

Arguments

dat
niter

number of iterations

var

variance of the random walk

alpha

temperature, expressed as power of the likelihood

Details

When alpha=1 the function operates (and can be used) as a regular Metropolis-Hastings algorithm.

Value

sample of mu's as a matrix of size niter x 2

Examples

dat=plotmix(plot=FALSE)$sample
simu=hmmeantemp(dat,1000)
plot(simu,pch=19,cex=.5,col="sienna",xlab=expression(mu[1]),ylab=expression(mu[2]))

bayess documentation built on Aug. 11, 2022, 5:07 p.m.

Related to hmmeantemp in bayess...