gibbsnorm {bayess} | R Documentation |
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)
Arguments
niter |
number of iterations in the Gibbs sampler |
dat |
mixture sample |
mix |
list defined as |
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.
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 |
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. Society 56, 363-375.
See Also
Examples
data(datha)
datha=as.matrix(datha)
mix=list(k=3,mu=mean(datha),sig=var(datha))
res=gibbsnorm(10,datha,mix)
plot(res$p[,1],type="l",col="steelblue3",xlab="iterations",ylab="p")