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

adjacency

Create an Adjacency Matrix for a set of Rankings


Description

Convert a set of rankings to an adjacency matrix summarising wins and losses between pairs of items.

Usage

adjacency(object, weights = NULL, ...)

Arguments

object

a rankings object, or an object that can be coerced by as.rankings.

weights

an optional vector of weights for the rankings.

...

further arguments passed to/from methods.

Details

For a "rankings" object based on N items, the adjacency matrix is an N by N matrix, with element (i, j) being the number of times item i wins over item j. For example, in the ranking \1\ > \3, 4\ > \2\, item 1 wins over items 2, 3, and 4, and items 3 and 4 win over item 2.

If weights is specified, the values in the adjacency matrix are the weighted counts.

Value

An N by N matrix, where N is the number of items that can be ranked.

Examples

X <- matrix(c(2, 1, 2, 1, 2,
              3, 2, 0, 0, 1,
              1, 0, 2, 2, 3), nrow = 3, byrow = TRUE)
X <- as.rankings(X)
adjacency(X)

adjacency(X, weights = c(1, 1, 2))

PlackettLuce

Plackett-Luce Models for Rankings

v0.4.0
GPL-3
Authors
Heather Turner [aut, cre] (<https://orcid.org/0000-0002-1256-3375>), Ioannis Kosmidis [aut] (<https://orcid.org/0000-0003-1556-0302>), David Firth [aut] (<https://orcid.org/0000-0003-0302-2312>), Jacob van Etten [ctb] (<https://orcid.org/0000-0001-7554-2558>)
Initial release

We don't support your browser anymore

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