Description Usage Arguments Details Value Author(s) References See Also Examples
This function applies the standard version of Equivalence Classes Representatives (ECR) algorithm (Papastamoulis and Iliopoulos, 2010). The set of all allocation variables is partitioned into equivalence classes and exactly one representative is chosen from each class. The practical implementation of this idea is to reorder the output so that all simulated allocation vectors (z
) are as similar as possible with a pivot allocation vector (zpivot
).
1 | ecr(zpivot, z, K)
|
zpivot |
n-dimensional integer vector (z_1,…,z_n) with z_i\in\{1,…,K\}, i=1,…,n. |
z |
m\times n integer array of the latent allocation vectors generated from an MCMC algorithm. |
K |
the number of mixture components (at least equal to 2). |
zpivot
should be chosen as an allocation vector that corresponds to a high-posterior density area, or in general as an allocation that is considered as a good allocation of the observations among the K components. The useR has to specify this pivot allocation vector as a good allocation of the observations among the mixture components. Some typical choices are the allocations that correspond to the complete or non-complete MAP/ML estimates.
permutations |
m\times K dimensional array of permutations |
Panagiotis Papastamoulis
Papastamoulis P. and Iliopoulos G. (2010). An artificial allocations based solution to the label switching problem in Bayesian analysis of mixtures of distributions. Journal of Computational and Graphical Statistics, 19: 313-331.
permute.mcmc
, label.switching
, ecr.iterative.1
, ecr.iterative.2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #load a toy example: MCMC output consists of the random beta model
# applied to a normal mixture of \code{K=2} components. The
# number of observations is equal to \code{n=5}. The number
# of MCMC samples is equal to \code{m=300}. The 300
# simulated allocations are stored to array \code{z}. The
# complete MAP estimate corresponds to iteration \code{mapindex}.
data("mcmc_output")
z<-data_list$"z"
K<-data_list$"K"
mapindex<-data_list$"mapindex"
# mcmc parameters are stored to array \code{mcmc.pars}
mcmc.pars<-data_list$"mcmc.pars"
# mcmc.pars[,,1]: simulated means of the two components
# mcmc.pars[,,2]: simulated variances
# mcmc.pars[,,3]: simulated weights
run<-ecr(zpivot = z[mapindex,],z = z, K = K)
# apply the permutations returned by typing:
reordered.mcmc<-permute.mcmc(mcmc.pars,run$permutations)
# reordered.mcmc[,,1]: reordered means of the two components
# reordered.mcmc[,,2]: reordered variances
# reordered.mcmc[,,3]: reordered weights
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.