Learn R Programming

PLMIX (version 2.1.1)

ppcheckPLMIX: Posterior predictive check for Bayesian mixtures of Plackett-Luce models

Description

Perform posterior predictive check to assess the goodness-of-fit of Bayesian mixtures of Plackett-Luce models with a different number of components.

Usage

ppcheckPLMIX(pi_inv, seq_G, MCMCsampleP, MCMCsampleW, top1 = TRUE,
  paired = TRUE, parallel = FALSE)

Arguments

pi_inv

An object of class top_ordering, collecting the numeric \(N\)\(\times\)\(K\) 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 \(L\)\(\times\)\((G*K)\) matrix with the MCMC samples of the component-specific support parameters.

MCMCsampleW

List of size length(seq_G), whose generic element is a numeric \(L\)\(\times\)\(G\) matrix with the MCMC samples of the mixture weights.

top1

Logical: whether the posterior predictive \(p\)-value based on the top item frequencies has to be computed. Default is TRUE.

paired

Logical: whether the posterior predictive \(p\)-value based on the paired comparison frequencies has to be computed. Default is TRUE.

parallel

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

Value

A list with a named element:

post_pred_pvalue

Numeric length(seq_G)\(\times\)\(2\) matrix of posterior predictive \(p\)-values based on the top item and paired comparison frequencies. If either top1 or paired argument is FALSE, the corresponding matrix entries are NA.

Details

The ppcheckPLMIX function returns two posterior predictive \(p\)-values based on two chi squared discrepancy variables involving: (i) the top item frequencies and (ii) the paired comparison frequencies. In the presence of partial sequences in the pi_inv matrix, the same missingness patterns observed in the dataset (i.e., the number of items ranked by each sample unit) are reproduced on the replicated datasets from the posterior predictive distribution.

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.

See Also

ppcheckPLMIX_cond

Examples

Run this code
# NOT RUN {
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)))
                            
## Checking goodness-of-fit of the estimated mixtures
CHECK <- ppcheckPLMIX(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))
CHECK$post_pred_pvalue

# }

Run the code above in your browser using DataLab