This function takes an object generated by the NMixMCMC
or GLMM_MCMC
function and internally re-labels the mixture
components using selected re-labeling algorithm. It also computes
posterior summary statistics for mixture means, weights, variances
which correspond to newly labeled MCMC sample. Further, posterior
component probabilities (poster.comp.prob_u
and
poster.comp.prob_b
components of the object object
) are
updated according to the newly labeled MCMC sample.
This function only works for models with a fixed number of mixture components.
NMixRelabel(object, type=c("mean", "weight", "stephens"), par, ...)# S3 method for default
NMixRelabel(object, type = c("mean", "weight", "stephens"), par, ...)
# S3 method for NMixMCMC
NMixRelabel(object, type = c("mean", "weight","stephens"), par,
prob=c(0.025, 0.5, 0.975), keep.comp.prob = FALSE, info, ...)
# S3 method for NMixMCMClist
NMixRelabel(object, type = c("mean", "weight","stephens"), par,
prob=c(0.025, 0.5, 0.975), keep.comp.prob = FALSE, info,
silent = FALSE, parallel = FALSE, ...)
# S3 method for GLMM_MCMC
NMixRelabel(object, type = c("mean", "weight", "stephens"), par,
prob = c(0.025, 0.5, 0.975), keep.comp.prob = FALSE, info,
silent = FALSE, ...)
# S3 method for GLMM_MCMClist
NMixRelabel(object, type = c("mean", "weight", "stephens"), par,
prob = c(0.025, 0.5, 0.975), keep.comp.prob = FALSE, jointly = FALSE,
info, silent = FALSE, parallel = FALSE, ...)
An object being equal to the value of the object
argument in
which the following components are updated according to new labeling
of the mixture components.
an object of apropriate class.
character string which specifies the type of the re-labeling algorithm.
additional parameters for particular re-labeling algorithms.
par
specifies margin which is used to order the
components. It is set to 1 if not given.
par
is empty.
par
is a list with components
type.init
, par
, maxiter
.
Component type.init
is a character string being equal to
either of “identity”, “mean”, “weight”. It
determines the way which is used to obtain initial re-labeling.
Component par
determines the margin in the case that
type.init
is equal to “mean”.
Component maxiter
determines maximum number of iterations
of the re-labeling algorithm.
probabilities for which the posterior quantiles of component allocation probabilities are computed.
logical. If TRUE
, posterior sample of
component allocation probabilities (for each subject) is kept in the
resulting object.
a logical value. If it is TRUE
then both chains
are processed together. In the output, all posterior summary
statistics are then also related to both chains as if it is one long
chain. If it is FALSE
then both chains are processed independently.
number which specifies frequency used to re-display the iteration counter during the computation.
a logical value indicating whether the information on the MCMC progress is to be supressed.
a logical value indicating whether parallel
computation (based on a package parallel
) should be used (if
possible) for re-labelling of the two chains.
optional additional arguments.
When the argument object
is of class NMixMCMC
, the
resulting object is equal to object
with the following
components being modified:
see NMixMCMC
see NMixMCMC
see NMixMCMC
see NMixMCMC
see NMixMCMC
see NMixMCMC
see NMixMCMC
see NMixMCMC
see NMixMCMC
see NMixMCMC
Additionally, new components are added, namely
a list with the posterior quantiles of
component probabilities. One list
component for each
quantile specified by prob
argument.
posterior sample of individual component
probabilities (also given random effects). It is an \(M \times
n\cdot K\) matrix where \(M\) is the length of the
posterior sample, \(n\) is the number of subjects, and \(K\)
is the number of mixture components. Component labels correspond
to the re-labelled sample. It is included in the
resulting object only if keep.comp.prob
argument is
TRUE
.
When the argument object
is of class GLMM_MCMC
, the
resulting object is equal to object
with the following
components being modified:
see GLMM_MCMC
see GLMM_MCMC
see GLMM_MCMC
see GLMM_MCMC
see GLMM_MCMC
see GLMM_MCMC
see GLMM_MCMC
see GLMM_MCMC
see GLMM_MCMC
see GLMM_MCMC
Additionally, new components are added, namely
a list with the posterior quantiles of
component probabilities. One list
component for each
quantile specified by prob
argument.
posterior sample of individual component
probabilities (also given random effects). It is an \(M \times
I\cdot K\) matrix where \(M\) is the length of the
posterior sample, \(I\) is the number of subjects, and \(K\)
is the number of mixture components. Component labels correspond
to the re-labelled sample. It is included in the
resulting object only if keep.comp.prob
argument is
TRUE
.
a matrix with the posterior means of component probabilities which are calculated with random effects integrated out.
a list with the posterior quantiles of
component probabilities. One list
component for each
quantile specified by prob
argument.
posterior sample of individual component
probabilities (with random effects integrated out). It is an \(M \times
I\cdot K\) matrix where \(M\) is the length of the
posterior sample, \(I\) is the number of subjects, and \(K\)
is the number of mixture components. Component labels correspond
to the re-labelled sample. It is included in the
resulting object only if keep.comp.prob
argument is
TRUE
.
Remark. These are the component probabilities which should normally be used for clustering purposes.
Arnošt Komárek arnost.komarek@mff.cuni.cz
Celeux, G. (1998). Bayesian inference for mixtures: The label-switching problem. In: COMPSTAT 98 (eds. R. Payne and P. Green), pp. 227-232. Heidelberg: Physica-Verlag.
Jasra, A., Holmes, C. C., and Stephens, D. A. (2005). Markov chain Monte Carlo methods and the label switching problem in Bayesian mixture modeling. Statistical Science, 20, 50-67.
Stephens, M. (1997). Bayesian methods for mixtures of normal distributions. DPhil Thesis. Oxford: University of Oxford. (Available from: http://stephenslab.uchicago.edu/publications.html (accessed on 05/02/2014)).
Stephens, M. (2000). Dealing with label switching in mixture models. Journal of the Royal Statistical Society, Series B, 62, 795-809.
NMixMCMC
, GLMM_MCMC
.
## See also additional material available in
## YOUR_R_DIR/library/mixAK/doc/
## or YOUR_R_DIR/site-library/mixAK/doc/
## - file PBCseq.R and
## https://www2.karlin.mff.cuni.cz/~komarek/software/mixAK/PBCseq.pdf
##
## ==============================================
Run the code above in your browser using DataLab