Description Usage Arguments Details Value Author(s) References See Also Examples
This function reorders the MCMC output using the geometrically-based Pivotal Reordering Algorithm (PRA) (Marin et al, 2005, Marin and Robert, 2007). The method requires as input the generated MCMC sample and a pivot parameter vector. The user should be careful in order the pivot elements have the same parameters with the generated MCMC output. The simulated MCMC sample should be provided by the useR as a m\times K\times J dimensional array, where m denotes the number of MCMC samples, K denotes the number of mixture components and J corresponds to the number of different parameter types of the model. The pivot should correspond to a high-posterior density point.
1 | pra(mcmc.pars, pivot)
|
mcmc.pars |
m\times K\times J array of simulated MCMC parameters. |
pivot |
K\times J array containing the parameter that will be used as a pivot. |
The positive integer J denotes the number of different parameter types of the model. For example, in a univariate normal mixture model there are J = 3 different types: means, variances and weights. In a Poisson mixture there are J=2 types: means and weights.
permutations |
m\times K dimensional array of permutations |
Panagiotis Papastamoulis
Marin, J.M., Mengersen, K. and Robert, C.P. (2005). Bayesian modelling and inference on mixtures of distributions. Handbook of Statistics (25), D. Dey and C.R. Rao (eds). Elsevier-Sciences.
Marin, J.M. and Robert, C.P. (2007). Bayesian Core: A Practical Approach to Computational Bayesian Statistics, Springer-Verlag, New York.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #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 1000 generated MCMC samples are stored
#to array mcmc.pars.
data("mcmc_output")
mcmc.pars<-data_list$"mcmc.pars"
mapindex<-data_list$"mapindex"
# mcmc parameters are stored to array \code{mcmc.pars}
# mcmc.pars[,,1]: simulated means of the two components
# mcmc.pars[,,2]: simulated variances of the two components
# mcmc.pars[,,3]: simulated weights of the two components
# We will apply PRA using as pivot the complete MAP estimate
# which corresponds to \code{mcmc.pars[mapindex,,]}
run<-pra(mcmc = mcmc.pars, pivot = mcmc.pars[mapindex,,])
# 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 of the components
# reordered.mcmc[,,3]: reordered weights
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.