gibbsnorm: Gibbs sampler for a generic mixture posterior distribution
Description
This function implements the generic Gibbs sampler of Diebolt and Robert (1994)
for producing a sample from the posterior distribution associated
with a univariate mixture of \(k\) normal components with all \(3k-1\) parameters
unknown.
Usage
gibbsnorm(niter, dat, mix)
Value
k
number of components (superfluous)
mu
Gibbs sample of all mean parameters
sig
Gibbs sample of all variance parameters
p
Gibbs sample of all weight parameters
lopost
sequence of log-likelihood values along Gibbs iterations
Arguments
niter
number of iterations in the Gibbs sampler
dat
mixture sample
mix
list defined as mix=list(k=k,p=p,mu=mu,sig=sig),
where k is an integer and the remaining entries are
vectors of length k
Details
Under conjugate priors on the means (normal distributions), variances (inverse gamma
distributions), and weights (Dirichlet distribution), the full conditional distributions
given the latent variables are directly available and can be used in a straightforward
Gibbs sampler. This function is only the first step of the function gibbs, but it
may be much faster as it avoids the computation of the evidence via Chib's approach.
References
Chib, S. (1995) Marginal likelihood from the Gibbs output.
J. American Statist. Associ.90, 1313-1321.
Diebolt, J. and Robert, C.P. (1992) Estimation of finite mixture distributions by Bayesian sampling.
J. Royal Statist. Society56, 363-375.