Learn R Programming

mcsm (version 1.0)

SAmix: Graphical representation of the simulated annealing sequence for the mixture posterior

Description

This function implements a simulated annealing algorithm to optimize the posterior distribution of a normal mixture with two components and only the means unknown, $$.25\mathcal{N}(\mu_1,1)+.75\mathcal{N}(\mu_2,1)$$ with a schedule $temp=1/log(1+t)$.

Usage

SAmix(x, tolerance = 10^(-4), factor = 1)

Arguments

x
two-dimensional vector, starting point of the simulated annealing algorithm
tolerance
maximal difference in the target value needed to stop the simulated annealing algorithm
factor
scale factor of $temp$ that determines the scale of the random walk

Value

theta
sequence of points explored by the simulated annealing algorithm
like
corresponding sequence of posterior values
ite
number of iterations to reach stable value

References

From Chapter 5 of EnteR Monte Carlo Statistical Methods

Examples

Run this code
da=sample(rbind(rnorm(10^2),2.5+rnorm(3*10^2)))
SAres=SAmix(x=c(-.3,.6),tol=10^(-2),fac=.1)

Run the code above in your browser using DataLab