Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot_top_k

Plot Top-k Rankings with Pairwise Preferences


Description

Plot the posterior probability, per item, of being ranked among the top-k for each assessor. This plot is useful when the data take the form of pairwise preferences.

Usage

plot_top_k(
  model_fit,
  burnin = model_fit$burnin,
  k = 3,
  rel_widths = c(rep(1, model_fit$n_clusters), 10)
)

Arguments

model_fit

An object of type BayesMallows, returned from compute_mallows.

burnin

A numeric value specifying the number of iterations to discard as burn-in. Defaults to model_fit$burnin, and must be provided if model_fit$burnin does not exist. See assess_convergence.

k

Integer specifying the k in top-k.

rel_widths

The relative widths of the plots of rho per cluster and the plot of assessors, respectively. This argument is passed on to plot_grid.

See Also

Examples

## Not run: 
  # We use the example dataset with beach preferences. Se the documentation to
  # compute_mallows for how to assess the convergence of the algorithm
  # We need to save the augmented data, so setting this option to TRUE
  model_fit <- compute_mallows(preferences = beach_preferences,
                               save_aug = TRUE)
  # We set burnin = 1000
  model_fit$burnin <- 1000
  # By default, the probability of being top-3 is plotted
  plot_top_k(model_fit)
  # We can also plot the probability of being top-5, for each item
  plot_top_k(model_fit, k = 5)
  # We get the underlying numbers with predict_top_k
  probs <- predict_top_k(model_fit)
  # To find all items ranked top-3 by assessors 1-3 with probability more than 80 %,
  # we do
  library(dplyr)
  probs %>%
    filter(assessor %in% 1:3, prob > 0.8)


## End(Not run)

BayesMallows

Bayesian Preference Learning with the Mallows Rank Model

v1.0.1
GPL-3
Authors
Oystein Sorensen [aut, cre] (<https://orcid.org/0000-0003-0724-3542>), Valeria Vitelli [aut] (<https://orcid.org/0000-0002-6746-0453>), Marta Crispino [aut], Qinghua Liu [aut], Cristina Mollica [aut], Luca Tardella [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.