gibbsmean {bayess} | R Documentation |
This function implements a Gibbs sampler for a toy mixture problem (Chapter 6) with two Gaussian components and only the means unknown, so that likelihood and posterior surfaces can be drawn.
gibbsmean(p, datha, niter = 10^4)
p |
first component weight |
datha |
dataset to be modelled as a mixture |
niter |
number of Gibbs iterations |
Sample of mu's as a matrix of size niter
x 2
dat=plotmix(plottin=FALSE)$sample simu=gibbsmean(0.7,dat,niter=100) plot(simu,pch=19,cex=.5,col="sienna",xlab=expression(mu[1]),ylab=expression(mu[2]))