label_switchPLMIX: Label switching adjustment of the Gibbs sampling simulations...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/PLMIXfunctions.R

Description

Remove the label switching phenomenon from the MCMC samples of Bayesian mixtures of Plackett-Luce models with G>1 components.

Usage

1
2
3
4
5
6
7
8
9
label_switchPLMIX(
  pi_inv,
  seq_G,
  MCMCsampleP,
  MCMCsampleW,
  MAPestP,
  MAPestW,
  parallel = FALSE
)

Arguments

pi_inv

An object of class top_ordering, collecting the numeric NxK data matrix of partial orderings, or an object that can be coerced with as.top_ordering.

seq_G

Numeric vector with the number of components of the Plackett-Luce mixtures to be assessed.

MCMCsampleP

List of size length(seq_G), whose generic element is a numeric Lx(G*K) matrix with the MCMC samples of the component-specific support parameters to be processed.

MCMCsampleW

List of size length(seq_G), whose generic element is a numeric LxG matrix with the MCMC samples of the mixture weights to be processed.

MAPestP

List of size length(seq_G), whose generic element is a numeric GxK matrix with the MAP estimates of the component-specific support parameters to be used as a pivot in the PRA method (see 'Details').

MAPestW

List of size length(seq_G), whose generic element is a numeric vector with the MAP estimates of the G mixture weights to be used as a pivot in the PRA method (see 'Details').

parallel

Logical: whether parallelization should be used. Default is FALSE.

Details

The label_switchPLMIX function performs the label switching adjustment of the MCMC samples via the Pivotal Reordering Algorithm (PRA) described in Marin et al (2005), by recalling the pra function from the label.switching package.

Value

A list of named objects:

final_sampleP

List of size length(seq_G), whose generic element is a numeric GxKxL array with the MCMC samples of the component-specific support parameters adjusted for label switching.

final_sampleW

List of size length(seq_G), whose generic element is a numeric LxG matrix with the MCMC samples of the mixture weights adjusted for label switching.

Author(s)

Cristina Mollica and Luca Tardella

References

Mollica, C. and Tardella, L. (2017). Bayesian Plackett-Luce mixture models for partially ranked data. Psychometrika, 82(2), pages 442–458, ISSN: 0033-3123, DOI: 10.1007/s11336-016-9530-0.

Papastamoulis, P. (2016). label.switching: An R Package for Dealing with the Label Switching Problem in MCMC Outputs. Journal of Statistical Software, 69(1), pages 1–24, DOI: 10.18637/jss.v069.c01.

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.

See Also

pra

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
data(d_carconf)
K <- ncol(d_carconf)

## Fit 1- and 2-component PL mixtures via MAP estimation
MAP_1 <- mapPLMIX_multistart(pi_inv=d_carconf, K=K, G=1, 
                             n_start=2, n_iter=400*1)

MAP_2 <- mapPLMIX_multistart(pi_inv=d_carconf, K=K, G=2, 
                             n_start=2, n_iter=400*2)
                                   
MAP_3 <- mapPLMIX_multistart(pi_inv=d_carconf, K=K, G=3, 
                             n_start=2, n_iter=400*3)
                                   
mcmc_iter <- 30
burnin <- 10

## Fit 1- and 2-component PL mixtures via Gibbs sampling procedure
GIBBS_1 <- gibbsPLMIX(pi_inv=d_carconf, K=K, G=1, n_iter=mcmc_iter, 
                      n_burn=burnin, init=list(p=MAP_1$mod$P_map,
                      z=binary_group_ind(MAP_1$mod$class_map,G=1)))
GIBBS_2 <- gibbsPLMIX(pi_inv=d_carconf, K=K, G=2, n_iter=mcmc_iter, 
                      n_burn=burnin, init=list(p=MAP_2$mod$P_map,
                      z=binary_group_ind(MAP_2$mod$class_map,G=2)))
GIBBS_3 <- gibbsPLMIX(pi_inv=d_carconf, K=K, G=3, n_iter=mcmc_iter, 
                      n_burn=burnin, init=list(p=MAP_3$mod$P_map,
                      z=binary_group_ind(MAP_3$mod$class_map,G=3)))
                            
## Adjusting the MCMC samples for label switching
LS <- label_switchPLMIX(pi_inv=d_carconf, seq_G=1:3, 
                   MCMCsampleP=list(GIBBS_1$P, GIBBS_2$P, GIBBS_3$P), 
                   MCMCsampleW=list(GIBBS_1$W, GIBBS_2$W, GIBBS_3$W), 
                   MAPestP=list(MAP_1$mod$P_map, MAP_2$mod$P_map, MAP_3$mod$P_map), 
                   MAPestW=list(MAP_1$mod$W_map, MAP_2$mod$W_map, MAP_3$mod$W_map))
str(LS)       

cmollica/PLMIX documentation built on Dec. 31, 2020, 10:04 p.m.