cdc_kemenyyoung: Kemeny-Young Method

Description Usage Arguments Value References Examples

View source: R/cdc_kemenyyoung.R

Description

Kemeny-Young method first lists all the permutations of candidates, that is, all possible orders, or possible ordered links. Then, it computes the sums of strength of these links. The top link is the one with the highest strength score, and the winner is the first one in this link. Currently, the maximum candidate number is 8 for speed and memory reasons.

Usage

1
2
cdc_kemenyyoung(x, allow_dup = TRUE, min_valid = 1, margin = FALSE,
  keep_all_link = FALSE)

Arguments

x

it accepts the following types of input: 1st, it can be an object of class vote. 2nd, it can be a user-given Condorcet matrix, 3rd, it can be a result of another Condorcet method, which is of class condorcet.

allow_dup

whether ballots with duplicated score values are taken into account. Default is TRUE.

min_valid

default is 1. If the number of valid entries of a ballot is less than this value, it will not be used.

margin

if it is FALSE (default), the values in Condorcet matrix are used, that is: if A vs. B is 30, B vs. A is 18, then 30 and 18 are used to calculate link strength; if it is TRUE, then 30 - 18 = 12 and -12 are used.

keep_all_link

if TRUE, the result will store all the links and their strength. However, it is quite memory-costing, so the default is FALSE.

Value

a condorcet object, which is essentially a list.

References

Examples

1
2
3
4
m <- matrix(c(0, 58, 58, 58, 42, 0, 32, 32, 42, 68, 0, 17, 42, 68, 83, 0), nr = 4)
colnames(m) <- c('m', 'n', 'c', 'k')
rownames(m) <- c('m', 'n', 'c', 'k')
y <- cdc_kemenyyoung(m, keep_all_link = TRUE) # winner is n

Example output

CREATING CDC MATRIX
------USE INPUT MATRIX
EXTRACTING INFO
SELECTING
COLLECTING RESULT
DONE

votesys documentation built on May 2, 2019, 1:32 p.m.