View source: R/setup_rank_data.R
setup_rank_data | R Documentation |
Prepare rank or preference data for further analyses.
setup_rank_data(
rankings = NULL,
preferences = NULL,
user_ids = numeric(),
observation_frequency = NULL,
validate_rankings = TRUE,
na_action = c("augment", "fail", "omit"),
cl = NULL,
max_topological_sorts = 1,
timepoint = NULL,
n_items = NULL
)
rankings |
A matrix of ranked items, of size | |||||||||||||
preferences |
A data frame with one row per pairwise comparison, and
columns
So if we have two assessors and five items, and assessor 1 prefers item 1
to item 2 and item 1 to item 5, while assessor 2 prefers item 3 to item 5,
we have the following
| |||||||||||||
user_ids |
Optional | |||||||||||||
observation_frequency |
A vector of observation frequencies (weights) to
apply do each row in | |||||||||||||
validate_rankings |
Logical specifying whether the rankings provided (or
generated from | |||||||||||||
na_action |
Character specifying how to deal with | |||||||||||||
cl |
Optional computing cluster used for parallelization when generating
transitive closure based on preferences, returned from
| |||||||||||||
max_topological_sorts |
When preference data are provided, multiple rankings will be consistent with the preferences stated by each users. These rankings are the topological sorts of the directed acyclic graph corresponding to the transitive closure of the preferences. This number defaults to one, which means that the algorithm stops when it finds a single initial ranking which is compatible with the rankings stated by the user. By increasing this number, multiple rankings compatible with the pairwise preferences will be generated, and one initial value will be sampled from this set. | |||||||||||||
timepoint |
Integer vector specifying the timepoint. Defaults to | |||||||||||||
n_items |
Integer specifying the number of items. Defaults to |
An object of class "BayesMallowsData"
, to be provided in the data
argument to compute_mallows()
.
Setting max_topological_sorts
larger than 1 means that many possible
orderings of each assessor's preferences are generated, and one of them is
picked at random. This can be useful when experiencing convergence issues,
e.g., if the MCMC algorithm does not mix properly.
It is assumed that the items are labeled starting from 1. For example, if a
single comparison of the following form is provided, it is assumed that
there is a total of 30 items (n_items=30
), and the initial ranking is a
permutation of these 30 items consistent with the preference 29<30.
assessor | bottom_item | top_item |
1 | 29 | 30 |
If in reality there are only two items, they should be relabeled to 1 and 2, as follows:
assessor | bottom_item | top_item |
1 | 1 | 2 |
Other preprocessing:
get_transitive_closure()
,
set_compute_options()
,
set_initial_values()
,
set_model_options()
,
set_priors()
,
set_progress_report()
,
set_smc_options()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.