| Type: | Package |
| Title: | Bayesian Analysis of Finite Mixture of Plackett-Luce Models |
| Version: | 2.2.0 |
| Date: | 2025-06-30 |
| Description: | Fit finite mixtures of Plackett-Luce models for partial top rankings/orderings within the Bayesian framework. It provides MAP point estimates via EM algorithm and posterior MCMC simulations via Gibbs Sampling. It also fits MLE as a special case of the noninformative Bayesian analysis with vague priors. In addition to inferential techniques, the package assists other fundamental phases of a model-based analysis for partial rankings/orderings, by including functions for data manipulation, simulation, descriptive summary, model selection and goodness-of-fit evaluation. Main references on the methods are Mollica and Tardella (2017) <doi:10.1007/s11336-016-9530-0> and Mollica and Tardella (2014) <doi:10.1002/sim.6224>. |
| Maintainer: | Cristina Mollica <cristina.mollica@uniroma1.it> |
| License: | GPL-2 |GPL-3 [expanded from: GPL (≥ 2)] |
| Encoding: | UTF-8 |
| Imports: | Rcpp (≥ 1.0.5), abind (≥ 1.4-5), foreach (≥ 1.4.4), ggplot2(≥ 2.2.1), ggmcmc (≥ 1.2), coda (≥ 0.19-1), reshape2 (≥1.4.3), rcdd (≥ 1.2), gridExtra (≥ 2.3), MCMCpack (≥ 1.4-2),label.switching (≥ 1.6), PlackettLuce (≥ 0.2-3), radarchart(≥ 0.3.1), methods, stats, utils |
| LinkingTo: | Rcpp |
| RoxygenNote: | 7.3.2 |
| Suggests: | doParallel, pmr (≥ 1.2.5), prefmod (≥ 0.8-34), rankdist (≥1.1.3), StatRank (≥ 0.0.6), e1071 (≥ 1.7-11) |
| LazyData: | true |
| NeedsCompilation: | yes |
| Packaged: | 2025-06-30 19:09:43 UTC; cristina |
| Author: | Cristina Mollica [aut, cre], Luca Tardella [aut] |
| Repository: | CRAN |
| Date/Publication: | 2025-06-30 19:20:01 UTC |
Bayesian Analysis of Finite Mixtures of Plackett-Luce Models for PartialRankings/Orderings
Description
ThePLMIX package for R provides functions to fit and analyze finitemixtures of Plackett-Luce models for partial top rankings/orderings withinthe Bayesian framework. It provides MAP point estimates via EM algorithm andposterior MCMC simulations via Gibbs Sampling. It also fits MLE as a specialcase of the noninformative Bayesian analysis with vague priors.
Details
In addition to inferential techniques, the package assists other fundamentalphases of a model-based analysis for partial rankings/orderings, byincluding functions for data manipulation, simulation, descriptive summary,model selection and goodness-of-fit evaluation.
Specific S3 classes and methods are also supplied to enhance the usabilityand foster exchange with other packages. Finally, to address the issue ofcomputationally demanding procedures typical in ranking data analysis,PLMIX takes advantage of a hybrid code linking the R environment withthe C++ programming language.
The Plackett-Luce model is one of the most popular and frequently appliedparametric distributions to analyze partial top rankings/orderings of afinite set of items. The present package allows to account for unobservedsample heterogeneity of partially ranked data with a model-based analysisrelying on Bayesian finite mixtures of Plackett-Luce models. The packageprovides a suite of functions that covers the fundamental phases of amodel-based analysis:
Ranking data manipulation
binary_group_indBinary group membership matrix fromthe mixture component labels.
freq_to_unitFrom thefrequency distribution to the dataset of individual orderings/rankings.
make_completeRandom completion of partialorderings/rankings data.
make_partialCensoring ofcomplete orderings/rankings data.
rank_ord_switchFromrankings to orderings and vice-versa.
unit_to_freqFrom the dataset of individualorderings/rankings to the frequency distribution.
Ranking data simulation
rPLMIXRandom sample from afinite mixture of Plackett-Luce models.
Ranking data description
paired_comparisonsPaired comparisonfrequencies.
rank_summariesSummary statistics ofpartial ranking/ordering data.
Model estimation
gibbsPLMIXBayesian analysis with MCMC posteriorsimulation via Gibbs sampling.
label_switchPLMIXLabelswitching adjustment of the Gibbs sampling simulations.
likPLMIXLikelihood evaluation for a mixture ofPlackett-Luce models.
loglikPLMIXLog-likelihoodevaluation for a mixture of Plackett-Luce models.
mapPLMIXMAP estimation via EM algorithm.
mapPLMIX_multistartMAP estimation via EM algorithmwith multiple starting values.
Class coercion and membership
as.top_orderingCoercion into top-orderingdatasets.
gsPLMIX_to_mcmcFrom the Gibbs samplingsimulation to an MCMC class object.
is.top_orderingTest for the consistency of input datawith a top-ordering dataset.
S3 class methods
plot.gsPLMIXPlot of the Gibbs sampling simulations.
plot.mpPLMIXPlot of the MAP estimates.
print.gsPLMIXPrint of the Gibbs sampling simulations.
print.mpPLMIXPrint of the MAP estimation algorithm.
summary.gsPLMIXSummary of the Gibbs sampling procedure.
summary.mpPLMIXSummary of the MAP estimation.
Model selection
bicPLMIXBIC value for the MLE of a mixture ofPlackett-Luce models.
selectPLMIXBayesian model selection criteria.
Model assessment
ppcheckPLMIXPosterior predictive diagnostics.
ppcheckPLMIX_condPosterior predictive diagnosticsconditionally on the number of ranked items.
Datasets
d_apaAmerican Psychological Association Data (partialorderings).
d_carconfCar Configurator Data (partialorderings).
d_dublinwestDublin West Data (partialorderings).
d_gamingGaming Platforms Data (completeorderings).
d_germanGerman Sample Data (completeorderings).
d_nascarNASCAR Data (partial orderings).
d_occupOccupation Data (complete orderings).
d_riceRice Voting Data (partial orderings).
Data have to be supplied as an object of classmatrix, where missingpositions/items are denoted with zero entries and Rank = 1 indicates themost-liked alternative. For a more efficient implementation of the methods,partial sequences with a single missing entry should be preliminarily filledin, as they correspond to complete rankings/orderings. In the presentsetting, ties are not allowed. Some quantities frequently recalled in themanual are the following:
NSample size.
KNumber of possible items.
GNumber of mixture components.
LSize of the final posterior MCMC sample (afterburn-in phase).
Author(s)
Cristina Mollica and Luca Tardella
Maintainer: Cristina Mollica <cristina.mollica@uniroma1.it>
References
Mollica, C. and Tardella, L. (2017). Bayesian Plackett-Lucemixture models for partially ranked data.Psychometrika,82(2), pages 442–458, ISSN: 0033-3123,<doi:10.1007/s11336-016-9530-0>.
Mollica, C. and Tardella, L. (2014). Epitope profiling via mixture modelingfor ranked data.Statistics in Medicine,33(21), pages3738–3758, ISSN: 0277-6715,<doi:10.1002/sim.6224/full>.
Likelihood and log-likelihood evaluation for a mixture of Plackett-Luce models
Description
Compute either the likelihood or the log-likelihood of the Plackett-Luce mixture model parameters for a partial ordering dataset.
Usage
likPLMIX(p, ref_order, weights, pi_inv)loglikPLMIX(p, ref_order, weights, pi_inv)Arguments
p | Numeric |
ref_order | Numeric |
weights | Numeric vector of |
pi_inv | An object of class |
Details
Theref_order argument accommodates for the more general mixture of Extended Plackett-Luce models (EPL), involving the additional reference order parameters (Mollica and Tardella 2014). A permutation of the firstK integers can be specified in each row of theref_order argument. Since the Plackett-Luce model is a special instance of the EPL with the reference order equal to the identity permutation, theref_order argument must be a matrix withG rows equal to(1,\dots,K) when dealing with Plackett-Luce mixtures.
Value
Either the likelihood or the log-likelihood value of the Plackett-Luce mixture model parameters for a partial ordering dataset.
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>.
Mollica, C. and Tardella, L. (2014). Epitope profiling via mixture modeling for ranked data.Statistics in Medicine,33(21), pages 3738–3758, ISSN: 0277-6715, <doi:10.1002/sim.6224>.
Examples
data(d_apa)K <- ncol(d_apa)G <- 3support_par <- matrix(1:(G*K), nrow=G, ncol=K)weights_par <- c(0.50, 0.25, 0.25)loglikPLMIX(p=support_par, ref_order=matrix(1:K, nrow=G, ncol=K, byrow=TRUE), weights=weights_par, pi_inv=d_apa)Coercion into top-ordering datasets
Description
Attempt to coerce the input data into a top-ordering dataset.
Usage
as.top_ordering( data, format_input = NULL, aggr = NULL, freq_col = NULL, ties_method = "random", ...)Arguments
data | An object containing the partial sequences to be coerced into an object of class |
format_input | Character string indicating the format of the |
aggr | Logical: whether the |
freq_col | Integer indicating the column of the |
ties_method | Character string indicating the treatment of sequences with ties (not used for data of class |
... | Further arguments passed to or from other methods (not used). |
Details
The coercion functionas.top_ordering tries to coerce the input data into an object of classtop_ordering after checking for possible partial sequences that do not satisfy the top-ordering requirements. If none of the supplied sequences satisfies the top-ordering conditions, an error message is returned.NA's in the inputdata are tacitly converted into zero entries.
Value
An object of S3 classc("top_ordering","matrix").
Author(s)
Cristina Mollica and Luca Tardella
References
Turner, H., Kormidis, I. and Firth, D. (2018). PlackettLuce: Plackett-Luce Models for Rankings. R package version 0.2-3.https://CRAN.R-project.org/package=PlackettLuce
Qian, Z. (2018). rankdist: Distance Based Ranking Models. R package version 1.1.3.https://CRAN.R-project.org/package=rankdist
See Also
Examples
## Coerce an object of class 'rankings' into an object of class 'top_ordering'library(PlackettLuce)RR <- matrix(c(1, 2, 0, 0,4, 1, 2, 3,2, 1, 1, 1,1, 2, 3, 0,2, 1, 1, 0,1, 0, 3, 2), nrow = 6, byrow = TRUE)RR_rank=as.rankings(RR)RR_rankas.top_ordering(RR_rank, ties_method="random")## Coerce an object of class 'RankData' into an object of class 'top_ordering'library(rankdist)data(apa_partial_obj)d_apa_top_ord=as.top_ordering(data=apa_partial_obj)identical(d_apa,d_apa_top_ord)## Coerce a data frame from the package prefmod into an object of class 'top_ordering'library(prefmod)data(carconf)carconf_rank=carconf[,1:6]carconf_top_ord=as.top_ordering(data=carconf_rank,format_input="ranking",aggr=FALSE)identical(d_carconf,carconf_top_ord)## Coerce a data frame from the package pmr into an object of class 'top_ordering'library(pmr)data(big4)head(big4)big4_top_ord=as.top_ordering(data=big4,format_input="ranking",aggr=TRUE,freq_col=5)head(big4_top_ord)BIC for the MLE of a mixture of Plackett-Luce models
Description
Compute BIC value for the MLE of a mixture of Plackett-Luce models fitted to partial orderings.
Usage
bicPLMIX(max_log_lik, pi_inv, G, ref_known = TRUE, ref_vary = FALSE)Arguments
max_log_lik | Maximized log-likelihood value. |
pi_inv | An object of class |
G | Number of mixture components. |
ref_known | Logical: whether the component-specific reference orders are known (not to be estimated). Default is |
ref_vary | Logical: whether the reference orders vary across mixture components. Default is |
Details
Themax_log_lik and the BIC values can be straightforwardly obtained from the output of themapPLMIX andmapPLMIX_multistart functions when the default noninformative priors are adopted in the MAP procedure. So, thebicPLMIX function is especially useful to compute the BIC value from the output of alternative MLE methods for mixtures of Plackett-Luce models implemented, for example, with other softwares.
Theref_known andref_vary arguments accommodate for the more general mixture of Extended Plackett-Luce models (EPL), involving the additional reference order parameters (Mollica and Tardella 2014). Since the Plackett-Luce model is a special instance of the EPL with the reference order equal to the identity permutation(1,\dots,K), the default values ofref_known andref_vary are set equal, respectively, toTRUE andFALSE.
Value
A list of two named objects:
max_log_lik | The |
bic | BIC value. |
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>.
Mollica, C. and Tardella, L. (2014). Epitope profiling via mixture modeling for ranked data.Statistics in Medicine,33(21), pages 3738–3758, ISSN: 0277-6715, <doi:10.1002/sim.6224>.
Schwarz, G. (1978). Estimating the dimension of a model.Ann. Statist.,6(2), pages 461–464, ISSN: 0090-5364, <doi:10.1002/sim.6224>.
See Also
mapPLMIX andmapPLMIX_multistart
Examples
data(d_carconf)K <- ncol(d_carconf)MAP_mult <- mapPLMIX_multistart(pi_inv=d_carconf, K=K, G=3, n_start=2, n_iter=400*3)bicPLMIX(max_log_lik=MAP_mult$mod$max_objective, pi_inv=d_carconf, G=3)$bic## EquivalentlyMAP_mult$mod$bicBinary group membership matrix
Description
Construct the binary group membership matrix from the multinomial classification vector.
Usage
binary_group_ind(class, G)Arguments
class | Numeric vector of class memberships. |
G | Number of possible different classes. |
Value
Numericlength(class)\timesG matrix of binary group memberships.
Author(s)
Cristina Mollica and Luca Tardella
Examples
binary_group_ind(class=c(3,1,5), G=6)American Psychological Association Data (partial orderings)
Description
The popular American Psychological Association dataset (d_apa)contains the results of the voting ballots of the 1980 presidentialelection. A total ofN=15449 voters ranked a maximum ofK=5candidates, conventionally classified as research psychologists (candidate 1and 3), clinical psychologists (candidate 4 and 5) and communitypsychologists (candidate 2). The winner of the election was candidate 3. Thedataset is composed of partial top orderings of varying lengths. Missingpositions are denoted with zero entries.
Format
Object of S3 classc("top_ordering","matrix") gathering amatrix of partial orderings withN=15449 rows andK=5 columnsEach row lists the candidates from the most-liked (Rank_1) to theleast-liked (Rank_5) in a given voting ballot.
References
Mollica, C. and Tardella, L. (2017). Bayesian Plackett-Lucemixture models for partially ranked data.Psychometrika,82(2), pages 442–258, ISSN: 0033-3123, <doi:10.1007/s11336-016-9530-0>.
Diaconis, P. W. (1988). Group representations in probability and statistics.Lecture Notes-Monograph Series, pages 94–96.
Diaconis, P. W. (1987). Spectral analysis for ranked data. Technical Report282, Dept of Statistics, Stanford University.
Examples
data(d_apa)head(d_apa)## Subset of complete sequencesd_apa_compl=d_apa[rowSums(d_apa!=0)>=(ncol(d_apa)-1),]head(d_apa_compl)Car Configurator Data (partial orderings)
Description
The Car Configurator dataset (d_carconf) came up from a marketingstudy aimed at investigating customer preferences toward different carfeatures. A sample ofN=435 customers were asked to construct theircar by using an online configurator system and choose amongK=6 carmodules in order of preference. The car features are labeled as: 1 = price,2 = exterior design, 3 = brand, 4 = technical equipment, 5 = producingcountry and 6 = interior design. The survey did not require a completeranking elicitation, therefore the dataset is composed of partial toporderings of varying lengths. Missing positions are denoted with zeroentries.
Format
Object of S3 classc("top_ordering","matrix") gathering amatrix of partial orderings withN=435 rows andK=6 columns.Each row lists the car features from the most important (Rank_1) tothe least important (Rank_6) for a given customer.
References
Mollica, C. and Tardella, L. (2017). Bayesian Plackett-Lucemixture models for partially ranked data.Psychometrika,82(2), pages 442–458, ISSN: 0033-3123, <doi:10.1007/s11336-016-9530-0>.
Hatzinger, R. and Dittrich, R. (2012). Prefmod: An R package for modelingpreferences based on paired comparisons, rankings, or ratings.Journalof Statistical Software,48(10), pages 1–31.
Dabic, M. and Hatzinger, R. (2009). Zielgruppenadaequate Ablaeufe inKonfigurationssystemen - eine empirische Studie im Automobilmarkt - PartialRankings. In Hatzinger, R., Dittrich, R. and Salzberger, T. (eds),Praeferenzanalyse mit R: Anwendungen aus Marketing, BehaviouralFinance und Human Resource Management. Wien: Facultas.
Examples
data(d_carconf)head(d_carconf)## Subset of complete sequencesd_carconf_compl=d_carconf[rowSums(d_carconf!=0)>=(ncol(d_carconf)-1),]head(d_carconf_compl)Dublin West Data (partial orderings)
Description
The Dublin West dataset (d_dublinwest) contains the results of thevoting ballots of the 2002 Irish general election from the Dublin Westconstituency. The Irish voting system allows voters to rank the candidatesin order of preferences, rather than only specify the favorite one. In theDublin West constituency,N=29988 voters ranked a maximum ofK=9candidates, labeled as: 1 = Bonnie R., 2 = Burton J., 3 = Doherty-Ryan D., 4= Higgins J., 5 = Lenihan B., 6 = McDonald M., 7 = Morrissey T., 8 = SmythJ. and 9 = Terry S.. The dataset is composed of partial top orderings ofvarying lengths. Missing positions are denoted with zero entries.
Format
Object of S3 classc("top_ordering","matrix") gathering apartial orderings withN=29988 rows andK=9 columns. Each rowlists the candidates from the most-liked (Rank_1) to the least-liked(Rank_9) in a given voting ballot.
Source
The 2002 Dublin West data have been downloaded fromhttps://preflib.github.io/PrefLib-Jekyll/ PrefLib: A Library for Preferences. In thatrepository, preferences with ties are also included. The original source waspublicly available from the Dublin County Returning Officer at the followingURL:https://dublincountyreturningofficer.com/.
References
Mattei, N. and Walsh, T. (2013) PrefLib: A Library of PreferenceData.Proceedings of Third International Conference on AlgorithmicDecision Theory (ADT 2013). Springer, Lecture Notes in ArtificialIntelligence, November 13-15, 2013.
Gormley, I. C. and Murphy, T. B. (2009). A grade of membership model forrank data.Bayesian Analysis,4(2), pages 65–295.
Gormley, I. C. and Murphy, T. B. (2008). Exploring Voting Blocs Within theIrish Electorate: A Mixture Modeling Approach.Journal of the AmericaStatistical Association,103(483), pages 1014–1027.
Examples
data(d_dublinwest)head(d_dublinwest)## Subset of complete sequencesd_dublinwest_compl=d_dublinwest[rowSums(d_dublinwest!=0)>=(ncol(d_dublinwest)-1),]head(d_dublinwest_compl)Gaming Platforms Data (complete orderings)
Description
The Gaming Platforms dataset (d_gaming) collects the results of asurvey conducted on a sample ofN=91 Dutch students, who were asked torankK=6 gaming platforms in order of preference, namely: 1 = X-Box, 2= PlayStation, 3 = PSPortable, 4 = GameCube, 5 = GameBoy and 6 = PersonalComputer. The dataset is composed of complete orderings.
Format
Object of S3 classc("top_ordering","matrix") gathering amatrix of complete orderings withN=91 rows andK=6 columns.Each row lists the gaming platforms from the most-liked (Rank_1) tothe least-liked (Rank_6) for a given student.
Source
The Gaming Platforms dataset in .csv format can be downloaded fromhttp://qed.econ.queensu.ca/jae/2012-v27.5/fok-paap-van_dijk/. The .csvfiles contains the preference data in ranking format and some covariatescollected for each student.
References
Fok, D., Paap, R. and Van Dijk, B. (2012). A Rank-Ordered LogitModel With Unobserved Heterogeneity In Ranking Capatibilities.Journalof Applied Econometrics,27(5), pages 831–846.
Examples
data(d_gaming)head(d_gaming)German Sample Data (complete orderings)
Description
The German Sample dataset (d_german) is part of a comparativecross-sectional study on political actions and mass participation involvingfive Western countries. The dataset regards a sample ofN=2262 Germanrespondents who were asked to rankK=4 political goals in order ofdesirability, namely: 1 = maintaining order in the nation, 2 = giving peoplemore say in the decisions of government, 3 = fighting rising prices and 4 =protecting freedom of speech. The dataset is composed of complete orderings.
Format
Object of S3 classc("top_ordering","matrix") gathering amatrix of complete orderings withN=2262 rows andK=4 columns.Each row lists the political goals from the most desiderable (Rank_1)to the least desiderable (Rank_4) for a given respondent.
References
Croon, M. A. (1989). Latent class models for the analysis ofrankings. In De Soete, G., Feger, H. and Klauer, K. C. (eds),NewDevelopments in Psychological Choice Modeling, pages 99–121.North-Holland: Amsterdam.
Barnes, S. H. et al. (1979). Political action. Mass participation in fiveWestern democracies. London: Sage.
Examples
data(d_german)head(d_german)NASCAR Data (partial orderings)
Description
The NASCAR dataset (d_nascar) collects the results of the 2002 seasonof stock car racing held in the United States. The 2002 championshipconsisted ofN=36 races, with 43 car drivers competing in each race. Atotal ofK=87 drivers participated in the 2002 season, taking part toa variable number of races: some of them competed in all the races, someothers in only one. The results of the entire 2002 season were collected inthe form of top-43 orderings, where the position of the not-competingdrivers in each race is assumed lower than the 43th, but undetermined.Missing positions are denoted with zero entries.
Format
Object of S3 classc("top_ordering","matrix") gathering amatrix of partial orderings withN=36 rows andK=87 columns.Each row lists the car drivers from the top position (Rank_1) to thebottom one (Rank_87) in a given race. Columns from the 44th to the87th are filled with zeros, because only 43 drivers competed in each race.
References
Caron, F. and Doucet, A. (2012). Efficient Bayesian inferencefor Generalized Bradley-Terry models.J. Comput. Graph. Statist.,21(1), pages 174–196.
Guiver, J. and Snelson, E. (2009). Bayesian inference for Plackett-Luceranking models. In Bottou, L. and Littman, M., editors,Proceedings ofthe 26th International Conference on Machine Learning - ICML 2009, pages377–384. Omnipress.
Hunter, D. R. (2004). MM algorithms for Generalized Bradley-Terry models.Ann. Statist.,32(1), pages 384–406.
Examples
data(d_nascar)head(d_nascar)## Compute the number of races for each of the 87 driverstable(c(d_nascar[,1:43]))## Identify drivers arrived last (43th position) in all the raceswhich(colSums(rank_summaries(d_nascar, format="ordering")$marginals[1:42,])==0)## Obscure drivers 84, 85, 86 and 87 to get the reduced dataset## with 83 racers employed by Hunter, D. R. (2004)d_nascar_hunter=d_nascar[,1:83]d_nascar_hunter[is.element(d_nascar_hunter,84:87)]=0Occupation Data (complete orderings)
Description
The Occupation dataset (d_occup) came up from a survey conducted ongraduates from the Technion-Insrael Institute of Tecnology. A sample ofN=143 graduates were asked to rankK=10 professions according tothe perceived prestige. The occupations are labeled as: 1 = faculty member,2 = owner of a business, 3 = applied scientist, 4 = operations researcher, 5= industrial engineer, 6 = manager, 7 = mechanical engineer, 8 = supervisor,9 = technician and 10 = foreman. The dataset is composed of completeorderings.
Format
Object of S3 classc("top_ordering","matrix") gathering amatrix of complete orderings withN=143 rows andK=10 columns.Each row lists the professions from the most-liked (Rank_1) to theleast-liked (Rank_10) for a given graduate.
References
Cohen, A. and Mallows, C. L. (1983). Assessing goodness of fit of rankingmodels to data.Journal of the Royal Statistical Society: Series D(The Statistician),32(4), pages 361–374, ISSN: 0039-0526.
Cohen, A. (1982). Analysis of large sets of ranking data.Communications in Statistics – Theory and Methods,11(3),pages 235–256.
Goldberg, A. I. (1976). The relevance of cosmopolitan/local orientations toprofessional values and behavior.Sociology of Work and Occupations,3(3), pages 331–356.
Examples
data(d_occup)head(d_occup)Rice Voting Data (partial orderings)
Description
The Rice Voting dataset (d_rice) collects the results of the 1992election of a faculty member to serve on the Presidential Search Committeein the Rice University. A total ofN=300 people casted their vote inthe ballots by ranking theK=5 candidates in the short list in apreferential manner. The dataset is composed of partial top orderings ofvarying lengths. Missing positions are denoted with zero entries.
Format
Object of S3 classc("top_ordering","matrix") gathering amatrix of partial orderings withN=300 rows andK=5 columns.Each row lists the faculty members from the most-liked (Rank_1) tothe least-liked (Rank_5) in a given voting ballot.
References
Marcus, P., Heiser, W. J. and D'Ambrosio, A. (2013). Comparisonof heterogeneous probability models for ranking data, Master Thesis, LeidenUniversity.
Baggerly, K. A. (1995). Visual estimation of structure in ranked data, PhDthesis, Rice University.
Examples
data(d_rice)head(d_rice)## Subset of complete sequencesd_rice_compl=d_rice[rowSums(d_rice!=0)>=(ncol(d_rice)-1),]head(d_rice_compl)Utility to fill in single missing entries of top-(K-1) sequences in partial ordering/ranking datasets
Description
Utility to fill in single missing entries of top-(K-1) sequences in partial ordering/ranking datasets
Usage
fill_single_entries(data)Arguments
data | Numeric data matrix of partial sequences. |
Value
Numeric data matrix of partial sequences in the same format of the inputdata with possible single missing entries filled.
Author(s)
Cristina Mollica and Luca Tardella
Individual rankings/orderings from the frequency distribution
Description
Construct the dataset of individual rankings/orderings from the frequency distribution of the distinct observed sequences.
Usage
freq_to_unit(freq_distr)Arguments
freq_distr | Numeric matrix of the distinct observed sequences with the corresponding frequencies indicated in the last |
Value
NumericN\timesK data matrix of observed individual sequences.
Author(s)
Cristina Mollica and Luca Tardella
Examples
library(e1071)K <- 4perm_matrix <- permutations(n=K)freq_data <- cbind(perm_matrix, sample(1:factorial(K)))freq_datafreq_to_unit(freq_distr=freq_data)Gibbs sampling for a Bayesian mixture of Plackett-Luce models
Description
Perform Gibbs sampling simulation for a Bayesian mixture of Plackett-Luce models fitted to partial orderings.
Usage
gibbsPLMIX( pi_inv, K, G, init = list(z = NULL, p = NULL), n_iter = 1000, n_burn = 500, hyper = list(shape0 = matrix(1, nrow = G, ncol = K), rate0 = rep(0.001, G), alpha0 = rep(1, G)), centered_start = FALSE)Arguments
pi_inv | An object of class |
K | Number of possible items. |
G | Number of mixture components. |
init | List of named objects with initialization values: |
n_iter | Total number of MCMC iterations. |
n_burn | Number of initial burn-in drawings removed from the returned MCMC sample. |
hyper | List of named objects with hyperparameter values for the conjugate prior specification: |
centered_start | Logical: whether a random start whose support parameters and weights should be centered around the observed relative frequency that each item has been ranked top. Default is |
Details
The sizeL of the final MCMC sample is equal ton_iter-n_burn.
Value
A list of S3 classgsPLMIX with named elements:
W | Numeric |
P | Numeric |
log_lik | Numeric vector of |
deviance | Numeric vector of |
objective | Numeric vector of |
call | The matched call. |
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>.
Examples
data(d_carconf)GIBBS <- gibbsPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_iter=30, n_burn=10)str(GIBBS)GIBBS$PGIBBS$WMCMC class objects from the Gibbs sampling simulations of a Bayesian mixture of Plackett-Luce models
Description
Coerce the Gibbs sampling simulations for a Bayesian mixture of Plackett-Luce models into anmcmc class object.
Usage
gsPLMIX_to_mcmc(gsPLMIX_out)Arguments
gsPLMIX_out | Object of class |
Details
gsPLMIX_to_mcmc attemps to coerce its argument by recalling theas.mcmc function of thecoda package.
Value
Anmcmc class object.
Author(s)
Cristina Mollica and Luca Tardella
References
Plummer, M., Best, N., Cowles, K. and Vines, K. (2006). CODA: Convergence Diagnosis and Output Analysis for MCMC,R News,6, pages 7–11, ISSN: 1609-3631.
See Also
Examples
data(d_carconf)GIBBS <- gibbsPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_iter=30, n_burn=10)## Coerce the posterior samples into an mcmc class objectgsPLMIX_to_mcmc(GIBBS)Top-ordering datasets
Description
Check the consistency of partial ordering data with a top-ordering dataset.
Usage
is.top_ordering(data, ...)Arguments
data | An object containing the partial orderings whose consistency with a top-ordering dataset has to be tested. The following classes are admissible for |
... | Further arguments passed to or from other methods (not used). |
Details
The argumentdata requires the partial sequences expressed in ordering format. When the value ofis.top-ordering isFALSE, the membership function returns also a message with the conditions that are not met for thedata to be a top-ordering dataset.NA's in the inputdata are tacitly converted into zero entries.
Value
Logical:TRUE if thedata argument is consistent with a top-ordering dataset (with a possible warning message if the supplied data need a further treatment with the coercion functionas.top_ordering before being processed with the core functions ofPLMIX) andFALSE otherwise.
Author(s)
Cristina Mollica and Luca Tardella
References
Turner, H., Kormidis, I. and Firth, D. (2018). PlackettLuce: Plackett-Luce Models for Rankings. R package version 0.2-3.https://CRAN.R-project.org/package=PlackettLuce
Qian, Z. (2018). rankdist: Distance Based Ranking Models. R package version 1.1.3.https://CRAN.R-project.org/package=rankdist
Examples
## A toy example of data matrix not satisfying the conditions to be a top-ordering datasettoy_data=rbind(1:5,c(0,4,3,2,1),c(4,3.4,2,1,5),c(2,3,0,0,NA),c(4,4,3,2,5),c(3,5,4,2,6),c(2,-3,1,4,5),c(2,0,1,4,5),c(2,3,1,1,1),c(2,3,0,4,0))is.top_ordering(data=toy_data)## A dataset from the StatRank package satisfying the conditions to be a top-ordering datasetlibrary(StatRank)data(Data.Election9)is.top_ordering(data=Data.Election9)Label switching adjustment of the Gibbs sampling simulations for Bayesian mixtures of Plackett-Luce models
Description
Remove the label switching phenomenon from the MCMC samples of Bayesian mixtures of Plackett-Luce models withG>1 components.
Usage
label_switchPLMIX( pi_inv, seq_G, MCMCsampleP, MCMCsampleW, MAPestP, MAPestW, parallel = FALSE)Arguments
pi_inv | An object of class |
seq_G | Numeric vector with the number of components of the Plackett-Luce mixtures to be assessed. |
MCMCsampleP | List of size |
MCMCsampleW | List of size |
MAPestP | List of size |
MAPestW | List of size |
parallel | Logical: whether parallelization should be used. Default is |
Details
Thelabel_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 thepra function from thelabel.switching package.
Value
A list of named objects:
final_sampleP | List of size |
final_sampleW | List of size |
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
Examples
data(d_carconf)K <- ncol(d_carconf)## Fit 1- and 2-component PL mixtures via MAP estimationMAP_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 <- 30burnin <- 10## Fit 1- and 2-component PL mixtures via Gibbs sampling procedureGIBBS_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 switchingLS <- 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)Label switching adjustment for mixtures of Plackett-Luce models
Description
Remove the label switching phenomenon from the MCMC samples of Bayesian mixtures of Plackett-Luce models with a different number of components.
Usage
label_switchPLMIX_single(pi_inv, G, MCMCsampleP, MCMCsampleW, MAPestP, MAPestW)Arguments
pi_inv | An object of class |
G | Number of mixture components. |
MCMCsampleP | Numeric |
MCMCsampleW | Numeric |
MAPestP | Numeric |
MAPestW | Numeric vector of the |
Details
Thelabel_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 thepra function from thelabel.switching package.
Value
A list of named objects:
final_sampleP | Numeric |
final_sampleW | Numeric |
Author(s)
Cristina Mollica and Luca Tardella
Completion of partial rankings/orderings
Description
Return complete rankings/orderings from partial sequences relying on a random generation of the missing positions/items.
Usage
make_complete( data, format_input, nranked = NULL, probitems = rep(1, ncol(data)))Arguments
data | Numeric |
format_input | Character string indicating the format of the |
nranked | Optional numeric vector of length |
probitems | Numeric vector with the |
Details
The completion of the partial top rankings/orderings is performed according to the Plackett-Luce scheme, that is, with a sampling without replacement of the not-ranked items by using the positive values in theprobitems argument as support parameters (normalization is not necessary).
Value
A list of two named objects:
completedata | Numeric |
nranked | Numeric vector of length |
Author(s)
Cristina Mollica and Luca Tardella
Examples
## Completion based on the top item frequenciesdata(d_dublinwest)head(d_dublinwest)top_item_freq <- rank_summaries(data=d_dublinwest, format_input="ordering", mean_rank=FALSE, pc=FALSE)$marginals["Rank_1",]d_dublinwest_compl <- make_complete(data=d_dublinwest, format_input="ordering", probitems=top_item_freq)head(d_dublinwest_compl$completedata)Censoring of complete rankings/orderings
Description
Return partial top rankings/orderings from complete sequences obtained either with user-specified censoring patterns or with a random truncation.
Usage
make_partial( data, format_input, nranked = NULL, probcens = rep(1, ncol(data) - 1))Arguments
data | Numeric |
format_input | Character string indicating the format of the |
nranked | Numeric vector of length |
probcens | Numeric vector of length |
Details
The censoring of the complete sequences can be performed in: (i) a deterministic way, by specifying the number of top positions to be retained for each sample unit in thenranked argument; (ii) a random way, by sequentially specifying the probabilities of the top-1, top-2,..., top-(K-1) censoring patterns in theprobcens argument. Recall that a top-(K-1) sequence corresponds to a complete ordering/ranking.
Value
A list of two named objects:
partialdata | Numeric |
nranked | Numeric vector of length |
Author(s)
Cristina Mollica and Luca Tardella
Examples
data(d_german)head(d_german)d_german_cens <- make_partial(data=d_german, format_input="ordering", probcens=c(0.3, 0.3, 0.4))head(d_german_cens$partialdata)## Check consistency with the nominal censoring probabilitiesround(prop.table(table(d_german_cens$nranked)), 2)MAP estimation for a Bayesian mixture of Plackett-Luce models
Description
Perform MAP estimation via EM algorithm for a Bayesian mixture of Plackett-Luce models fitted to partial orderings.
Usage
mapPLMIX( pi_inv, K, G, init = list(p = NULL, omega = NULL), n_iter = 1000, hyper = list(shape0 = matrix(1, nrow = G, ncol = K), rate0 = rep(0, G), alpha0 = rep(1, G)), eps = 10^(-6), centered_start = FALSE, plot_objective = FALSE)Arguments
pi_inv | An object of class |
K | Number of possible items. |
G | Number of mixture components. |
init | List of named objects with initialization values: |
n_iter | Maximum number of EM iterations. |
hyper | List of named objects with hyperparameter values for the conjugate prior specification: |
eps | Tolerance value for the convergence criterion. |
centered_start | Logical: whether a random start whose support parameters and weights should be centered around the observed relative frequency that each item has been ranked top. Default is |
plot_objective | Logical: whether the objective function (that is the kernel of the log-posterior distribution) should be plotted. Default is |
Details
Under noninformative (flat) prior setting, the EM algorithm for MAP estimation corresponds to the EMM algorithm described by Gormley and Murphy (2006) to perform frequentist inference. In this case, the MAP solution coincides with the MLE and the output vectorslog_lik andobjective coincide as well.
ThemapPLMIX function performs the MAP procedure with a single starting value. To address the issue of local maxima in the posterior distribution, see themapPLMIX_multistart function.
Value
A list of S3 classmpPLMIX with named elements:
W_map | Numeric vector with the MAP estimates of the |
P_map | Numeric |
z_hat | Numeric |
class_map | Numeric vector of |
log_lik | Numeric vector of the log-likelihood values at each iteration. |
objective | Numeric vector of the objective function values (that is the kernel of the log-posterior distribution) at each iteration. |
max_objective | Maximized objective function value. |
bic | BIC value (only for the default flat priors, otherwise |
conv | Binary convergence indicator: 1 = convergence has been achieved, 0 = otherwise. |
call | The matched call. |
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>.
Gormley, I. C. and Murphy, T. B. (2006). Analysis of Irish third-level college applications data.Journal of the Royal Statistical Society: Series A,169(2), pages 361–379, ISSN: 0964-1998, <doi:10.1111/j.1467-985X.2006.00412.x>.
See Also
Examples
data(d_carconf)MAP <- mapPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_iter=400*3)str(MAP)MAP$P_mapMAP$W_mapMAP estimation for a Bayesian mixture of Plackett-Luce models with multiple starting values
Description
Perform MAP estimation via EM algorithm with multiple starting values for a Bayesian mixture of Plackett-Luce models fitted to partial orderings.
Usage
mapPLMIX_multistart( pi_inv, K, G, n_start = 1, init = rep(list(list(p = NULL, omega = NULL)), times = n_start), n_iter = 200, hyper = list(shape0 = matrix(1, nrow = G, ncol = K), rate0 = rep(0, G), alpha0 = rep(1, G)), eps = 10^(-6), plot_objective = FALSE, init_index = 1:n_start, parallel = FALSE, centered_start = FALSE)Arguments
pi_inv | An object of class |
K | Number of possible items. |
G | Number of mixture components. |
n_start | Number of starting values. |
init | List of |
n_iter | Maximum number of EM iterations. |
hyper | List of named objects with hyperparameter values for the conjugate prior specification: |
eps | Tolerance value for the convergence criterion. |
plot_objective | Logical: whether the objective function (that is the kernel of the log-posterior distribution) should be plotted. Default is |
init_index | Numeric vector indicating the positions of the starting values in the |
parallel | Logical: whether parallelization should be used. Default is |
centered_start | Logical: whether a random start whose support parameters and weights should be centered around the observed relative frequency that each item has been ranked top. Default is |
Details
Under noninformative (flat) prior setting, the EM algorithm for MAP estimation corresponds to the EMM algorithm described by Gormley and Murphy (2006) to perform frequentist inference. In this case the MAP solution coincides with the MLE. The best model in terms of maximized posterior distribution is returned.
Value
A list of S3 classmpPLMIX with named elements:
mod | List of named objects describing the best model in terms of maximized posterior distribution. See output values of the single-run |
max_objective | Numeric vector of the maximized objective function values for each initialization. |
convergence | Binary vector with |
call | The matched call. |
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>.
Gormley, I. C. and Murphy, T. B. (2006). Analysis of Irish third-level college applications data.Journal of the Royal Statistical Society: Series A,169(2), pages 361–379, ISSN: 0964-1998, <doi:10.1111/j.1467-985X.2006.00412.x>.
See Also
Examples
data(d_carconf)MAP_mult <- mapPLMIX_multistart(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_start=2, n_iter=400*3)str(MAP_mult)MAP_mult$mod$P_mapMAP_mult$mod$W_mapUtility to switch from a partial ranking to a partial ordering (missing positions denoted with zero)
Description
Utility to switch from a partial ranking to a partial ordering (missing positions denoted with zero)
Usage
myorder(x)Arguments
x | Numeric integer vector |
Author(s)
Cristina Mollica and Luca Tardella
Paired comparison matrix for a partial ordering/ranking dataset
Description
Construct the paired comparison matrix for a partial ordering/ranking dataset.
Usage
paired_comparisons(data, format_input, nranked = NULL)Arguments
data | Numeric |
format_input | Character string indicating the format of the |
nranked | Optional numeric vector of length |
Value
NumericK\timesK paired comparison matrix: the(i,i')-th entry indicates the number of sample units that preferred itemi to itemi'.
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>.
See Also
Examples
data(d_dublinwest)paired_comparisons(data=d_dublinwest, format_input="ordering")Plot the Gibbs sampling simulations for a Bayesian mixture of Plackett-Luce models
Description
plot method for classgsPLMIX. It builds a suite of plots, visual convergence diagnostics and credible intervals for the MCMC samples of a Bayesian mixture of Plackett-Luce models. Graphics can be plotted directly into the current working device or stored into an external file placed into the current working directory.
Usage
## S3 method for class 'gsPLMIX'plot( x, file = "ggmcmc-output.pdf", family = NA, plot = NULL, param_page = 5, width = 7, height = 10, dev_type_html = "png", post_est = "mean", max_scale_radar = NULL, ...)Arguments
x | Object of class |
file | Character vector with the name of the file to be created in the current working directory. Defaults is "ggmcmc-output.pdf". When NULL, plots are directly returned into the current working device (not recommended). This option allows also the user to work with an opened pdf (or other) device. When the file has an html file extension, the output is an Rmarkdown report with the figures embedded in the html file. |
family | Character string indicating the name of the family of parameters to be plotted. A family of parameters is considered to be any group of parameters with the same name but different numerical values (for example |
plot | Character vector containing the names of the desired plots. Default is |
param_page | Number of parameters to be plotted in each page. Defaults is 5. |
width | Numeric scalar indicating the width of the pdf display in inches. Defaults is 7. |
height | Numeric scalar indicating the height of the pdf display in inches. Defaults is 10. |
dev_type_html | Character vector indicating the type of graphical device for the html output. Default is |
post_est | Character string indicating the point estimates of the Plackett-Luce mixture parameters to be computed from the |
max_scale_radar | Numeric scalar indicating the maximum value on each axis of the radar plot for the support parameter point estimates. Default is |
... | Further arguments passed to or from other methods (not used). |
Details
Plots of the MCMC samples include histograms, densities, traceplots, running means plots, overlapped densities comparing the complete and partial samples, autocorrelation functions, crosscorrelation plots and caterpillar plots of the 90 and 95% equal-tails credible intervals. Note that the latter are created for the support parameters (when eitherfamily=NA orfamily="p"), for the mixture weights in the caseG>1 (when eitherfamily=NA orfamily="w"), for the log-likelihood values (whenfamily="log_lik"), for the deviance values (whenfamily="deviance"). Convergence tools include the potential scale reduction factor and the Geweke z-score. These functionalities are implemented with a call to theggs andggmcmc functions of theggmcmc package (see 'Examples' for the specification of theplot argument) and for the objective function values (whenfamily="objective").
By recalling thechartJSRadar function from theradarchart package and the routines of theggplot2 package,plot.gsPLMIX additionally produces a radar plot of the support parameters and, whenG>1, a donut plot of the mixture weights based on the posterior point estimates. The radar chart is returned in the Viewer Pane.
Author(s)
Cristina Mollica and Luca Tardella
References
Ashton, D. and Porter, S. (2016). radarchart: Radar Chart from 'Chart.js'. R package version 0.3.1.https://CRAN.R-project.org/package=radarchart
Wickham, H. (2009). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York.
Fernandez-i-Marin, X. (2006). ggmcmc: Analysis of MCMC Samples and Bayesian Inference,Journal of Statistical Software,70(9), pages 1–20, <doi:10.18637/jss.v070.i09>.
See Also
ggs,ggmcmc,chartJSRadar andggplot
Examples
# Not run:data(d_carconf)GIBBS <- gibbsPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=5, n_iter=30, n_burn=10)# Not run:# Plot posterior samples supplied as an gsPLMIX class object# plot(GIBBS)# Selected plots of the posterior samples of the support parameters# plot(GIBBS, family="p", plot=c("compare_partial","Rhat","caterpillar"), param_page=6)# Selected plots of the posterior samples of the mixture weights# plot(GIBBS, family="w", plot=c("histogram","running","crosscorrelation","caterpillar"))# Selected plots of the posterior log-likelihood values# plot(GIBBS, family="log_lik", plot=c("autocorrelation","geweke"), param_page=1)# Selected plots of the posterior deviance values# plot(GIBBS, family="deviance", plot=c("traceplot","density"), param_page=1)Plot the MAP estimates for a Bayesian mixture of Plackett-Luce models
Description
plot method for classmpPLMIX.
Usage
## S3 method for class 'mpPLMIX'plot(x, max_scale_radar = NULL, ...)Arguments
x | Object of class |
max_scale_radar | Numeric scalar indicating the maximum value on each axis of the radar plot for the support parameter point estimates. Default is |
... | Further arguments passed to or from other methods (not used). |
Details
By recalling thechartJSRadar function from theradarchart package and the routines of theggplot2 package,plot.mpPLMIX produces a radar plot of the support parameters and, whenG>1, a donut plot of the mixture weights and a heatmap of the component membership probabilities based on the MAP estimates. The radar chart is returned in the Viewer Pane.
Author(s)
Cristina Mollica and Luca Tardella
References
Ashton, D. and Porter, S. (2016). radarchart: Radar Chart from 'Chart.js'. R package version 0.3.1.https://CRAN.R-project.org/package=radarchart
Wickham, H. (2009). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York.
See Also
Examples
# Not run:data(d_carconf)MAP <- mapPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=3)plot(MAP)# Not run:MAP_multi <- mapPLMIX_multistart(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_start=5)plot(MAP_multi)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 |
seq_G | Numeric vector with the number of components of the Plackett-Luce mixtures to be assessed. |
MCMCsampleP | List of size |
MCMCsampleW | List of size |
top1 | Logical: whether the posterior predictive |
paired | Logical: whether the posterior predictive |
parallel | Logical: whether parallelization should be used. Default is |
Details
TheppcheckPLMIX function returns two posterior predictivep-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 thepi_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.
Value
A list with a named element:
post_pred_pvalue | Numeric |
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>.
See Also
Examples
data(d_carconf)K <- ncol(d_carconf)## Fit 1- and 2-component PL mixtures via MAP estimationMAP_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 <- 30burnin <- 10## Fit 1- and 2-component PL mixtures via Gibbs sampling procedureGIBBS_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 mixturesCHECK <- 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_pvalueConditional posterior predictive check for Bayesian mixtures of Plackett-Luce models
Description
Perform conditional posterior predictive check to assess the goodness-of-fit of Bayesian mixtures of Plackett-Luce models with a different number of components.
Usage
ppcheckPLMIX_cond( pi_inv, seq_G, MCMCsampleP, MCMCsampleW, top1 = TRUE, paired = TRUE, parallel = FALSE)Arguments
pi_inv | An object of class |
seq_G | Numeric vector with the number of components of the Plackett-Luce mixtures to be assessed. |
MCMCsampleP | List of size |
MCMCsampleW | List of size |
top1 | Logical: whether the posterior predictive |
paired | Logical: whether the posterior predictive |
parallel | Logical: whether parallelization should be used. Default is |
Details
TheppcheckPLMIX_cond function returns two posterior predictivep-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 thepi_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. Differently from theppcheckPLMIX function, the condional discrepancy measures are obtained by summing up the chi squared discrepancies computed on subsamples of observations with the same number of ranked items.
Value
A list with a named element:
post_pred_pvalue_cond | Numeric |
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>.
See Also
Examples
data(d_carconf)K <- ncol(d_carconf)## Fit 1- and 2-component PL mixtures via MAP estimationMAP_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 <- 30burnin <- 10## Fit 1- and 2-component PL mixtures via Gibbs sampling procedureGIBBS_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 mixturesCHECKCOND <- ppcheckPLMIX_cond(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))CHECKCOND$post_pred_pvalueConditional predictive posteriorp-values
Description
Compute conditional predictive posteriorp-values based on top paired comparison frequencies to assess the goodness-of-fit of a Bayesian mixtures of Plackett-Luce models for partial orderings.
Usage
ppcheckPLMIX_cond_single( pi_inv, G, MCMCsampleP, MCMCsampleW, top1 = TRUE, paired = TRUE)Arguments
pi_inv | An object of class |
G | Number of mixture components. |
MCMCsampleP | Numeric |
MCMCsampleW | Numeric |
top1 | Logical: whether the posterior predictive |
paired | Logical: whether the posterior predictive |
Details
In the case of partial orderings, the same missingness patterns of the observed dataset, i.e., the number of items ranked by each sample unit, are reproduced on the replicated datasets.
Value
A list of named objects:
post_pred_pvalue_top1 | If |
post_pred_pvalue_paired | If |
Author(s)
Cristina Mollica and Luca Tardella
Posterior predictive check for a mixture of Plackett-Luce models
Description
Compute predictive posteriorp-values based on top item and paired comparison frequencies to assess the goodness-of-fit of a Bayesian mixtures of Plackett-Luce models for partial orderings.
Usage
ppcheckPLMIX_single( pi_inv, G, MCMCsampleP, MCMCsampleW, top1 = TRUE, paired = TRUE)Arguments
pi_inv | An object of class |
G | Number of mixture components. |
MCMCsampleP | Numeric |
MCMCsampleW | Numeric |
top1 | Logical: whether the posterior predictive |
paired | Logical: whether the posterior predictive |
Details
In the case of partial orderings, the same missingness patterns of the observed dataset, i.e., the number of items ranked by each sample unit, are reproduced on the replicated datasets.
Value
A list of named objects:
post_pred_pvalue_top1 | If |
post_pred_pvalue_paired | If |
Author(s)
Cristina Mollica and Luca Tardella
Print of the Gibbs sampling simulation of a Bayesian mixture of Plackett-Luce models
Description
print method for classgsPLMIX. It shows some general information on the Gibbs sampling simulation for a Bayesian mixture of Plackett-Luce models.
Usage
## S3 method for class 'gsPLMIX'print(x, ...)Arguments
x | Object of class |
... | Further arguments passed to or from other methods (not used). |
Author(s)
Cristina Mollica and Luca Tardella
See Also
Examples
## Print of the Gibbs sampling proceduredata(d_carconf)GIBBS <- gibbsPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_iter=30, n_burn=10)print(GIBBS)Print of the MAP estimation algorithm for a Bayesian mixture of Plackett-Luce models
Description
print method for classmpPLMIX. It shows some general information on the MAP estimation procedure for a Bayesian mixture of Plackett-Luce models.
Usage
## S3 method for class 'mpPLMIX'print(x, ...)Arguments
x | Object of class |
... | Further arguments passed to or from other methods (not used). |
Author(s)
Cristina Mollica and Luca Tardella
See Also
mapPLMIX andmapPLMIX_multistart
Examples
## Print of the MAP procedure with a single starting pointdata(d_carconf)MAP <- mapPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=3)print(MAP)## Print of the MAP procedure with 5 starting pointsMAP_multi <- mapPLMIX_multistart(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_start=5)print(MAP_multi)Print of the summary of Gibbs sampling simulation of a Bayesian mixture of Plackett-Luce models.
Description
print method for classsummary.gsPLMIX. It shows some general information on the Gibbs sampling simulation of a Bayesian mixture of Plackett-Luce models.
Usage
## S3 method for class 'summary.gsPLMIX'print(x, ...)Arguments
x | Object of class |
... | Further arguments passed to or from other methods (not used). |
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>.
Mollica, C. and Tardella, L. (2014). Epitope profiling via mixture modeling for ranked data.Statistics in Medicine,33(21), pages 3738–3758, ISSN: 0277-6715, <doi:10.1002/sim.6224>.
Print of the summary of MAP estimation for a Bayesian mixture of Plackett-Luce models
Description
print method for classsummary.mpPLMIX. It provides summaries for the MAP estimation of a Bayesian mixture of Plackett-Luce models.
Usage
## S3 method for class 'summary.mpPLMIX'print(x, ...)Arguments
x | Object of class |
... | Further arguments passed to or from other methods (not used). |
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>.
Mollica, C. and Tardella, L. (2014). Epitope profiling via mixture modeling for ranked data.Statistics in Medicine,33(21), pages 3738–3758, ISSN: 0277-6715, <doi:10.1002/sim.6224>.
Random sample from a mixture of Plackett-Luce models
Description
Draw a random sample of complete orderings/rankings from aG-component mixture of Plackett-Luce models.
Usage
rPLMIX( n = 1, K, G, p = t(matrix(1/K, nrow = K, ncol = G)), ref_order = t(matrix(1:K, nrow = K, ncol = G)), weights = rep(1/G, G), format_output = "ordering")Arguments
n | Number of observations to be sampled. Default is 1. |
K | Number of possible items. |
G | Number of mixture components. |
p | Numeric |
ref_order | Numeric |
weights | Numeric vector of |
format_output | Character string indicating the format of the returned simulated dataset ( |
Details
Positive values are required forp andweights arguments (normalization is not necessary).
Theref_order argument accommodates for the more general mixture of Extended Plackett-Luce models (EPL), involving the additional reference order parameters (Mollica and Tardella 2014). A permutation of the firstK integers can be specified in each row of theref_order argument to generate a sample from aG-component mixture of EPL. Since the Plackett-Luce model is a special instance of the EPL with the reference order equal to the identity permutation(1,\dots,K), the default value of theref_order argument is forward orders.
Value
IfG=1, a numericN\timesK matrix of simulated complete sequences. IfG>1, a list of two named objects:
comp | Numeric vector of |
sim_data | Numeric |
Author(s)
Cristina Mollica and Luca Tardella
Examples
K <- 6G <- 3support_par <- matrix(1:(G*K), nrow=G, ncol=K)weights_par <- c(0.50, 0.25, 0.25)set.seed(47201)simulated_data <- rPLMIX(n=5, K=K, G=G, p=support_par, weights=weights_par)simulated_data$compsimulated_data$sim_dataAppropriate simulation of starting values for tandom initialization of Gibbs Sampling. It start from the mle corresponding to no-group structure and then it randomly selects rescaled random support points (with sum 1) of G mixture components such that the marginal support coincides with the mle support for G=1Random generation of starting values of the component-specific support parameters for Gibbs sampling
Description
Appropriate simulation of starting values for tandom initialization of Gibbs Sampling. It start from the mle corresponding to no-group structure and then it randomly selects rescaled random support points (with sum 1) of G mixture components such that the marginal support coincides with the mle support for G=1Random generation of starting values of the component-specific support parameters for Gibbs sampling
Usage
random_start(mlesupp, givenweights, alpha = rep(1, G))Arguments
mlesupp | MLE of support parameters |
givenweights | A numeric vector of |
alpha | A numeric vector of |
Value
out A numericG\timesK matrix with starting values of the component-specific support parameters
Author(s)
Cristina Mollica and Luca Tardella
Switch from orderings to rankings and vice versa
Description
Convert the format of the input dataset from orderings to rankings and vice versa.
Usage
rank_ord_switch(data, format_input, nranked = NULL)Arguments
data | Numeric |
format_input | Character string indicating the format of the |
nranked | Optional numeric vector of length |
Value
NumericN\timesK data matrix of partial sequences with inverse format.
Author(s)
Cristina Mollica and Luca Tardella
Examples
## From orderings to rankings for the Dublin West datasetdata(d_dublinwest)head(d_dublinwest)rank_ord_switch(data=head(d_dublinwest), format_input="ordering")Descriptive summaries for a partial ordering/ranking dataset
Description
Compute rank summaries and censoring patterns for a partial ordering/ranking dataset.
Usage
rank_summaries( data, format_input, mean_rank = TRUE, marginals = TRUE, pc = TRUE)Arguments
data | Numeric |
format_input | Character string indicating the format of the |
mean_rank | Logical: whether the mean rank vector has to be computed. Default is |
marginals | Logical: whether the marginal rank distributions have to be computed. Default is |
pc | Logical: whether the paired comparison matrix has to be computed. Default is |
Value
A list of named objects:
nranked | Numeric vector of length |
nranked_distr | Frequency distribution of the |
na_or_not | Numeric |
mean_rank | Numeric vector of length |
marginals | Numeric |
pc | Numeric |
Author(s)
Cristina Mollica and Luca Tardella
References
Marden, J. I. (1995). Analyzing and modeling rank data.Monographs on Statistics and Applied Probability (64). Chapman & Hall, ISSN: 0-412-99521-2. London.
Examples
data(d_carconf)rank_summaries(data=d_carconf, format_input="ordering")Bayesian selection criteria for mixtures of Plackett-Luce models
Description
Compute Bayesian comparison criteria for mixtures of Plackett-Luce models with a different number of components.
Usage
selectPLMIX( pi_inv, seq_G, MCMCsampleP = vector(mode = "list", length = length(seq_G)), MCMCsampleW = vector(mode = "list", length = length(seq_G)), MAPestP, MAPestW, deviance, post_est = "mean", parallel = FALSE)Arguments
pi_inv | An object of class |
seq_G | Numeric vector with the number of components of the Plackett-Luce mixtures to be compared. |
MCMCsampleP | List of size |
MCMCsampleW | List of size |
MAPestP | List of size |
MAPestW | List of size |
deviance | List of size |
post_est | Character string indicating the point estimates of the Plackett-Luce mixture parameters to be computed from the MCMC sample. This argument is ignored when MAP estimates are supplied in the |
parallel | Logical: whether parallelization should be used. Default is |
Details
TheselectPLMIX function privileges the use of the MAP point estimates to compute the Bayesian model comparison criteria, since they are not affected by the label switching issue. By setting both theMAPestP andMAPestW arguments equal to NULL, the user can alternatively compute the selection measures by relying on a different posterior summary ("mean" or"median") specified in thepost_est argument. In the latter case, the MCMC samples for each Plackett-Luce mixture must be supplied in the listsMCMCsampleP andMCMCsampleW. The drawback when working with point estimates other than the MAP is that the possible presence of label switching has to be previously removed from the traces to obtain meaningful results. See thelabel_switchPLMIX function to perfom label switching adjustment of the MCMC samples.
Several model selection criteria are returned. The two versions of DIC correspond to alternative ways of computing the effective number of parameters: DIC1 was proposed by Spiegelhalter et al. (2002) with penalty namedpD, whereas DIC2 was proposed by Gelman et al. (2004) with penalty namedpV. The latter coincides with the AICM introduced by Raftery et al. (2007), that is, the Bayesian counterpart of AIC. BPIC1 and BPIC2 are obtained from the two DIC by simply doubling the penalty term, as suggested by Ando (2007) to contrast DIC's tendency to overfitting. BICM1 is the Bayesian variant of the BIC, originally presented by Raftery et al. (2007) and entirely based on the MCMC sample. The BICM2, instead, involved the MAP estimate without the need of its approximation from the MCMC sample as for the BICM1.
Value
A list of named objects:
point_estP | List of size |
point_estW | List of size |
fitting | Numeric |
penalties | Numeric |
criteria | Numeric |
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>.
Ando, T. (2007). Bayesian predictive information criterion for the evaluation of hierarchical Bayesian and empirical Bayes models.Biometrika,94(2), pages 443–458.
Raftery, A. E, Satagopan, J. M., Newton M. A. and Krivitsky, P. N. (2007). BAYESIAN STATISTICS 8.Proceedings of the eighth Valencia International Meeting 2006, pages 371–416. Oxford University Press.
Gelman, A., Carlin, J. B., Stern, H. S. and Rubin, D. B. (2004). Bayesian data analysis. Chapman & Hall/CRC, Second Edition, ISBN: 1-58488-388-X. New York.
Spiegelhalter, D. J., Best, N. G., Carlin, B. P. and Van Der Linde, A. (2002). Bayesian measures of model complexity and fit.Journal of the Royal Statistical Society: Series B (Statistical Methodology),64(4), pages 583–639.
Examples
data(d_carconf)K <- ncol(d_carconf)## Fit 1- and 2-component PL mixtures via MAP estimationMAP_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)mcmc_iter <- 30burnin <- 10## Fit 1- and 2-component PL mixtures via Gibbs sampling procedureGIBBS_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)))## Select the optimal number of componentsSELECT <- selectPLMIX(pi_inv=d_carconf, seq_G=1:2, MAPestP=list(MAP_1$mod$P_map, MAP_2$mod$P_map), MAPestW=list(MAP_1$mod$W_map, MAP_2$mod$W_map), deviance=list(GIBBS_1$deviance, GIBBS_2$deviance))SELECT$criteriaBayesian selection criteria for mixtures of Plackett-Luce models
Description
Compute Bayesian comparison criteria for mixtures of Plackett-Luce models with a different number of components.
Usage
selectPLMIX_single( pi_inv, G, MCMCsampleP = NULL, MCMCsampleW = NULL, MAPestP, MAPestW, deviance, post_est = "mean")Arguments
pi_inv | An object of class |
G | Number of mixture components. |
MCMCsampleP | Numeric |
MCMCsampleW | Numeric |
MAPestP | Numeric |
MAPestW | Numeric vector of the |
deviance | Numeric vector of posterior deviance values. |
post_est | Character string indicating the point estimates of the Plackett-Luce mixture parameters to be computed from the MCMC sample. This argument is ignored when MAP estimates are supplied in the |
Details
Two versions of DIC and BPIC are returned corresponding to two alternative ways of computing the penalty term: the former was proposed by Spiegelhalter et al. (2002) and is denoted withpD, whereas the latter was proposed by Gelman et al. (2004) and is denoted withpV. DIC2 coincides with AICM, that is, the Bayesian counterpart of AIC introduced by Raftery et al. (2007).
Value
A list of named objects:
point_estP | Numeric |
point_estW | Numeric |
D_bar | Posterior expected deviance. |
D_hat | Deviance function evaluated at |
pD | Effective number of parameters computed as |
pV | Effective number of parameters computed as half the posterior variance of the deviance. |
DIC1 | Deviance Information Criterion with penalty term equal to |
DIC2 | Deviance Information Criterion with penalty term equal to |
BPIC1 | Bayesian Predictive Information Criterion obtained from |
BPIC2 | Bayesian Predictive Information Criterion obtained from |
BICM1 | Bayesian Information Criterion-Monte Carlo. |
BICM2 | Bayesian Information Criterion-Monte Carlo based on the actual MAP estimate given in the |
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>.
Ando, T. (2007). Bayesian predictive information criterion for the evaluation of hierarchical Bayesian and empirical Bayes models.Biometrika,94(2), pages 443–458.
Raftery, A. E, Satagopan, J. M., Newton M. A. and Krivitsky, P. N. (2007). BAYESIAN STATISTICS 8.Proceedings of the eighth Valencia International Meeting 2006, pages 371–416. Oxford University Press.
Gelman, A., Carlin, J. B., Stern, H. S. and Rubin, D. B. (2004). Bayesian data analysis. Chapman & Hall/CRC, Second Edition, ISBN: 1-58488-388-X. New York.
Spiegelhalter, D. J., Best, N. G., Carlin, B. P., Van Der Linde, A. (2002). Bayesian measures of model complexity and fit.Journal of the Royal Statistical Society: Series B (Statistical Methodology),64(4), pages 583–639.
Summary of the Gibbs sampling procedure for a Bayesian mixture of Plackett-Luce models
Description
summary method for classgsPLMIX. It provides summary statistics and credible intervals for the Gibbs sampling simulation of a Bayesian mixture of Plackett-Luce models.
Usage
## S3 method for class 'gsPLMIX'summary( object, quantiles = c(0.025, 0.25, 0.5, 0.75, 0.975), hpd_prob = 0.95, digits = 2, ...)Arguments
object | Object of class |
quantiles | Numeric vector of quantile probabilities. |
hpd_prob | Numeric scalar in the grid of values spanning the interval (0,1) by 0.05, giving the posterior probability content of the HPD intervals. Supplied values outside the grid are rounded. |
digits | Number of decimal places for rounding the posterior summaries. |
... | Further arguments passed to or from other methods (not used). |
Details
Posterior summaries include means, standard deviations, naive standard errors of the means (ignoring autocorrelation of the chain) and time-series standard errors based on an estimate of the spectral density at 0. They correspond to thestatistics element of the output returned by thesummary.mcmc function of thecoda package. Highest posterior density (HPD) intervals are obtained by recalling theHPDinterval function of thecoda package.
Value
A list of summary statistics for thegsPLMIX class object:
statistics | Numeric matrix with posterior summaries in each row (see 'Details'). |
quantiles | Numeric matrix with posterior quantiles at the given |
HPDintervals | Numeric matrix with 100 |
Modal_orderings | Numeric |
call | The matched call. |
Author(s)
Cristina Mollica and Luca Tardella
References
Plummer, M., Best, N., Cowles, K. and Vines, K. (2006). CODA: Convergence Diagnosis and Output Analysis for MCMC,R News,6, pages 7–11, ISSN: 1609-3631.
See Also
Examples
data(d_carconf)GIBBS <- gibbsPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_iter=30, n_burn=10)## Summary of the Gibbs sampling proceduresummary(GIBBS)Summary of the MAP estimation for a Bayesian mixture of Plackett-Luce models
Description
summary method for classmpPLMIX. It provides summaries for the MAP estimation of a Bayesian mixture of Plackett-Luce models.
Usage
## S3 method for class 'mpPLMIX'summary(object, digits = 2, ...)Arguments
object | Object of class |
digits | Number of decimal places for rounding the summaries. |
... | Further arguments passed to or from other methods (not used). |
Value
A list of summaries for thempPLMIX class object:
MAP_w | Numeric vector with the MAP estimates of the |
MAP_p | Numeric |
MAP_modal_orderings | Numeric |
group_distr | Numeric vector with the relative frequency distribution of the mixture component memberships based on MAP allocation. Returned only when when |
perc_conv_rate | Numeric scalar with the percentage of MAP algorithm convergence over the multiple starting points. Returned only when |
Author(s)
Cristina Mollica and Luca Tardella
Examples
## Summary of the MAP procedure with a single starting pointdata(d_carconf)MAP <- mapPLMIX(pi_inv=d_carconf, K=ncol(d_carconf), G=3)summary(MAP)## Summary of the MAP procedure with 5 starting pointsMAP_multi <- mapPLMIX_multistart(pi_inv=d_carconf, K=ncol(d_carconf), G=3, n_start=5)summary(MAP_multi)Frequency distribution from the individual rankings/orderings
Description
Construct the frequency distribution of the distinct observed sequences from the dataset of individual rankings/orderings.
Usage
unit_to_freq(data)Arguments
data | Numeric |
Value
Numeric matrix of the distinct observed sequences with the corresponding frequencies indicated in the last(K+1)-th column.
Author(s)
Cristina Mollica and Luca Tardella
Examples
## Frequency distribution for the APA top-ordering datasetdata(d_apa)unit_to_freq(data=d_apa)