cdc_rankedpairs: Ranked Pairs Method

Description Usage Arguments Details Value References Examples

View source: R/cdc_rankedpairs.R

Description

It is also called Tideman method. See details.

Usage

1
cdc_rankedpairs(x, allow_dup = TRUE, min_valid = 1)

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.

Details

The method first summarizes the result of pairwise comparison, the order used is the order of winning votes from large to small. So if pairwise comparison has ties (that is, the number of voters who prefer a than b is equal to the number of voters who prefer b than a, the method will fail, and the winner will be NULL).

The second step is called tally. If a wins b with 100 votes, b wins c with 80 votes, then we put a-b-100 ahead of b-c-80. Suppose a wins b with 100 votes, a wins c with 100 votes, then we have a tie; so we have to check the relation between b and c. If b wins c, then we put a-c-100 ahead of a-b-100. Suppose a wins b with 100 votes, d wins b with 100 votes, then again we have a tie and have to check the a-d relation. If d wins a, then we put d-b-100 ahead of a-b-100. Suppose a wins b with 100 votes, e wins f with 100 votes, then the ties cannot be solved, so the winner will be NULL.

The third step, after the above mentioned tally, is called lock-in. As the relations have been sorted according to their strength from large to small in the tally step, we now add them one by one. The rule is: if a relation is contradictory with those already locked in relations, this relation will be discarded.

For example, suppose we have already add relation a > b and b > c, then the two relations are locked in. As a result, we should not add b > a. Also, as a > b and b > c indicate a > c, so we should not add c > a. After this process, we will finally find the winner who defeats all others.

Value

a condorcet object, which is essentially a list.

References

Examples

1
2
3
4
5
raw <- rbind(c('m', 'n', 'c', 'k'), c('n', 'c', 'k', 'm'), 
    c('c', 'k', 'n', 'm'), c('k', 'c', 'n', 'm')) 
raw <- list2ballot(m = raw, n = c(42, 26, 15, 17))
vote <- create_vote(raw, xtype = 2, candidate = c('m', 'n', 'c', 'k'))
y <- cdc_rankedpairs(vote)

Example output

MATCHING NAMES AND SCORES
COUNTING NA AND DUP VALUES
MAKING CONDORCET TABLE
COLLECTING RESULT
DONE
CREATING CDC MATRIX
------USE CDC MATRIX WITH NA IN x
EXTRACTING INFO
SELECTING
------PAIRWISE
------SORTING
------LOCKING IN
COLLECTING RESULT
DONE

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