cdc_dodgson: Dodgson Method

Description Usage Arguments Details Value References Examples

View source: R/cdc_dodgson.R

Description

The original Dodgson method checks the number of votes each candidate has to rob from other candidates; the winner is with the smallest number. However, the function cdc_dodgson uses two alternative methods rather than the original Dodgson method. The two methods are Tideman score method and Dodgson Quick method. See Details.

Usage

1
cdc_dodgson(x, allow_dup = TRUE, min_valid = 1, dq_t = "dq")

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.

dq_t

the alternative Dodgson methods to be used. Default is "dq", for Dodgson Quick method; it can also be "t", Tideman score method.

Details

Suppose the candidates are A, B, C and D. If A wins B in pairwise comparison or has equal votes with B, then add 0 to A. If C wins A, then add to A adv(C, A), that is, the number of voters that prefer C than A, minus the number of voters that prefer A than A. Again, if D wins A, then add to A that number. Then, we sum up the points belong to A. We do the same thing to B, C and D. The one gets the least points is the winner. This is what we do in Tideman score method. In Dodgson Quick method, we first compute the number of votes, then divide it by 2 and get the ceiling, and sum all of them up.

Value

a condorcet object, which is essentially a list.

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
raw <- list2ballot(
    x = list(
        c('A', 'B', 'C', 'D', 'E', 'F'), 
        c('F', 'A', 'B', 'C', 'D', 'E'),
        c('E', 'D', 'C', 'B', 'F', 'A'),
        c('B', 'A', 'C', 'D', 'E', 'F'),
        c('F', 'E', 'D', 'C', 'B', 'A'),
        c('F', 'B', 'A', 'C', 'D', 'E'),
        c('E', 'D', 'C', 'A', 'F', 'B'),
        c('E', 'B', 'A', 'C', 'D', 'F'),
        c('F', 'D', 'C', 'A', 'E', 'B'),
        c('D', 'B', 'A', 'C', 'E', 'F'),
        c('F', 'E', 'C', 'A', 'D', 'B')
    ), 
    n = c(19, 12, 12, 9, 9, 10, 10 , 10 , 10, 10, 10)
)
vote <- create_vote(raw, xtype = 3, candidate = c('A', 'B', 'C', 'D', 'E', 'F'))
win1 <- cdc_simple(vote) # no winner
win2 <- cdc_dodgson(vote, dq_t = "dq") # A
win2 <- cdc_dodgson(win1, dq_t = "dq") # A
win3 <- cdc_dodgson(vote, dq_t = "t") # B
win3 <- cdc_dodgson(win2, dq_t = "t") # B

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
COLLECTING RESULT
DONE
CREATING CDC MATRIX
------USE CDC MATRIX WITH NA IN x
EXTRACTING INFO
SELECTING
COLLECTING RESULT
DONE
CREATING CDC MATRIX
EXTRACTING INFO
SELECTING
COLLECTING RESULT
DONE
CREATING CDC MATRIX
------USE CDC MATRIX WITH NA IN x
EXTRACTING INFO
SELECTING
COLLECTING RESULT
DONE
CREATING CDC MATRIX
EXTRACTING INFO
SELECTING
COLLECTING RESULT
DONE

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