Learn R Programming

relations (version 0.6-13)

scores: Relation Scores

Description

Compute scores for the tuples of (ensembles of) endorelations.

Usage

# S3 method for relation
relation_scores(x,
                method = c("ranks", "Barthelemy/Monjardet",
                           "Borda", "Kendall", "Wei",
                           "differential", "Copeland"),
                normalize = FALSE, ...)
# S3 method for relation_ensemble
relation_scores(x,
                method = c("Borda", "Kendall", "differential",
                           "Copeland"),
                normalize = FALSE,
                weights = 1, ...)

Value

A vector of scores, with names taken from the relation domain labels.

Arguments

x

an object inheriting from class relation, representing an endorelation.

method

character string indicating the method (see Details).

normalize

logical indicating whether the score vector should be normalized to sum up to 1.

weights

Numeric vector of weights used in incidence aggregation, recycled as needed.

...

further arguments to be passed to methods.

Details

In the following, consider an endorelation \(R\) on \(n\) objects. Let the in-degree \(I(x)\) and out-degree \(O(x)\) of an object \(x\) be defined as the numbers of objects \(y\) such that \(y R x\) and, respectively, \(x R y\), and let \(D(x) = I(x) - O(x)\) be the differential of \(x\) (see Regenwetter and Rykhlevskaia (2004)). Note that \(I\) and \(O\) are given by the column sums and row sums of the incidence matrix of \(R\). If \(R\) is a preference relation with a \(\le\) interpretation, \(D(x)\) is the difference between the numbers of objects dominated by \(x\) (i.e., \(< x\)) and dominating \(x\) (i.e., \(> x\)), as “ties” cancel out.

relation_score() is generic with methods for relations and relation ensembles. Available built-in score methods for the relation method are as follows:

"ranks"

generalized ranks. A linear transformation of the differential \(D\) to the range from 1 to \(n\). An additional argument decreasing can be used to specify the order of the ranks. By default, or if decreasing is true, objects are ranked according to decreasing differential (“from the largest to the smallest” in the \(\le\) preference context) using \((n + 1 - D(x)) / 2\). Otherwise, if decreasing is false, objects are ranked via \((n + 1 + D(x)) / 2\) (“from the smallest to the largest”). See Regenwetter and Rykhlevskaia (2004) for more details on generalized ranks.

"Barthelemy/Monjardet"

\((M(x) + N(x) - 1) / 2\), where \(M(x)\) and \(N(x)\) are the numbers of objects \(y\) such that \(y R x\), and \(y R x\) and not \(x R y\), respectively. If \(R\) is a \(\le\) preference relation, we get the number of dominated objects plus half the number of the equivalent objects minus 1 (the “usual” average ranks minus one if the relation is complete). See Barthélemy and Monjardet (1981).

"Borda", "Kendall"

the out-degrees. See Borda (1770) and Kendall (1955).

"Wei"

the eigenvector corresponding to the greatest eigenvalue of the incidence matrix of the complement of \(R\). See Wei (1952).

"differential", "Copeland"

the differentials, equivalent to the negative net flow of Bouyssou (1992), and also to the Copeland scores.

For relation ensembles, currently only "differential"/"Copeland" and "Borda"/"Kendall" are implemented. They are computed on the aggregated incidences of the ensembles' relations.

Definitions of scores for “preference relations” \(R\) are somewhat ambiguous because \(R\) can encode \(\le\) or \(\ge\) (or strict variants thereof) relationships (and all such variants are used in the literature). Package relations generally assumes a \(\le\) encoding, and that scores in the strict sense should increase with preference (the most preferred get the highest scores) whereas ranks decrease with preference (the most preferred get the lowest ranks).

References

J.-P. Barthélemy and B. Monjardet (1981), The median procedure in cluster analysis and social choice theory. Mathematical Social Sciences, 1, 235--267. tools:::Rd_expr_doi("10.1016/0165-4896(81)90041-X").

J. C. Borda (1781), Mémoire sur les élections au scrutin. Histoire de l'Académie Royale des Sciences.

D. Bouyssou (1992), Ranking methods based on valued preference relations: A characterization of the net flow network. European Journal of Operational Research, 60, 61--67. tools:::Rd_expr_doi("10.1016/0377-2217(92)90333-5").

M. Kendall (1955), Further contributions to the theory of paired comparisons. Biometrics, 11, 43--62. tools:::Rd_expr_doi("10.2307/3001479").

M. Regenwetter and E. Rykhlevskaia (2004), On the (numerical) ranking associated with any finite binary relation. Journal of Mathematical Psychology, 48, 239--246. tools:::Rd_expr_doi("10.1016/j.jmp.2004.03.003").

T. H. Wei (1952). The algebraic foundation of ranking theory. Unpublished thesis, Cambridge University.

Examples

Run this code
## Example taken from Cook and Cress (1992, p.74)
I <- matrix(c(0, 0, 1, 1, 1,
              1, 0, 0, 0, 1,
              0, 1, 0, 0, 1,
              0, 1, 1, 0, 0,
              0, 0, 0, 1, 0),
            ncol = 5,
            byrow = TRUE)
R <- relation(domain = letters[1:5], incidence = I)

## Note that this is a "preference matrix", so take complement:
R <- !R

## Compare Kendall and Wei scores
cbind(
      Kendall = relation_scores(R, method = "Kendall", normalize = TRUE),
      Wei = relation_scores(R, method = "Wei", normalize = TRUE)
     )

## Example taken from Cook and Cress (1992, p.136)
## Note that the results indicated for the Copeland scores have
## (erroneously?) been computed from the *unweighted* votes.
## Also, they report the votes as strict preferences, so we
## create the dual relations.

D <- letters[1:5]
X <- as.relation(ordered(D, levels = c("b", "c", "a", "d", "e")))
Y <- as.relation(ordered(D, levels = c("d", "a", "e", "c", "b")))
Z <- as.relation(ordered(D, levels = c("e", "c", "b", "a", "d")))
E <- relation_ensemble(X, Y, Z)
relation_scores(E, "Copeland")
relation_scores(E, "Borda", weights = c(4, 3, 2))

Run the code above in your browser using DataLab