NMixRelabel: Re-labeling the MCMC output of the mixture model

View source: R/NMixRelabel.R

NMixRelabelR Documentation

Re-labeling the MCMC output of the mixture model

Description

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.

Usage

NMixRelabel(object, type=c("mean", "weight", "stephens"), par, ...)

## Default S3 method:
NMixRelabel(object, type = c("mean", "weight", "stephens"), par, ...)

## S3 method for class '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 class '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 class '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 class '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, ...)

Arguments

object

an object of apropriate class.

type

character string which specifies the type of the re-labeling algorithm.

par

additional parameters for particular re-labeling algorithms.

mean

par specifies margin which is used to order the components. It is set to 1 if not given.

weight

par is empty.

stephens

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.

prob

probabilities for which the posterior quantiles of component allocation probabilities are computed.

keep.comp.prob

logical. If TRUE, posterior sample of component allocation probabilities (for each subject) is kept in the resulting object.

jointly

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.

info

number which specifies frequency used to re-display the iteration counter during the computation.

silent

a logical value indicating whether the information on the MCMC progress is to be supressed.

parallel

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.

Value

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.

Value for NMixMCMC object

When the argument object is of class NMixMCMC, the resulting object is equal to object with the following components being modified:

relabel

see NMixMCMC

order

see NMixMCMC

rank

see NMixMCMC

poster.mean.w

see NMixMCMC

poster.mean.mu

see NMixMCMC

poster.mean.Q

see NMixMCMC

poster.mean.Sigma

see NMixMCMC

poster.mean.Li

see NMixMCMC

poster.comp.prob_u

see NMixMCMC

poster.comp.prob_b

see NMixMCMC

Additionally, new components are added, namely

quant.comp.prob_b

a list with the posterior quantiles of component probabilities. One list component for each quantile specified by prob argument.

comp.prob_b

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.

Value for GLMM_MCMC object

When the argument object is of class GLMM_MCMC, the resulting object is equal to object with the following components being modified:

relabel_b

see GLMM_MCMC

order_b

see GLMM_MCMC

rank_b

see GLMM_MCMC

poster.mean.w_b

see GLMM_MCMC

poster.mean.mu_b

see GLMM_MCMC

poster.mean.Q_b

see GLMM_MCMC

poster.mean.Sigma_b

see GLMM_MCMC

poster.mean.Li_b

see GLMM_MCMC

poster.comp.prob_u

see GLMM_MCMC

poster.comp.prob_b

see GLMM_MCMC

Additionally, new components are added, namely

quant.comp.prob_b

a list with the posterior quantiles of component probabilities. One list component for each quantile specified by prob argument.

comp.prob_b

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.

poster.comp.prob

a matrix with the posterior means of component probabilities which are calculated with random effects integrated out.

quant.comp.prob

a list with the posterior quantiles of component probabilities. One list component for each quantile specified by prob argument.

comp.prob

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.

Author(s)

Arnošt Komárek arnost.komarek@mff.cuni.cz

References

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.

See Also

NMixMCMC, GLMM_MCMC.

Examples

## 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
##
## ==============================================

mixAK documentation built on Sept. 25, 2023, 5:08 p.m.

Related to NMixRelabel in mixAK...