condorcet {SafeVote} | R Documentation |
Count votes using the Condorcet voting method.
Description
The Condorcet method elects the candidate who wins a majority of the ranked vote in every head to head election against each of the other candidates. A Condorcet winner is a candidate who beats all other candidates in pairwise comparisons. Analogously, a Condorcet loser is a candidate who loses against all other candidates. Neither Condorcet winner nor loser might exist.
Usage
condorcet(
votes,
runoff = FALSE,
nseats = 1,
safety = 1,
fsep = "\t",
quiet = FALSE,
...
)
Arguments
votes |
A matrix or data.frame containing the votes. Rows correspond
to the votes, columns correspond to the candidates. If |
runoff |
Logical. If TRUE and no Condorcet winner exists, the election goes into a run-off, see below. |
nseats |
the number of seats to be filled in this election |
safety |
Parameter for a clustering heuristic on a total ranking of
the candidates. Conjecture: the default of |
fsep |
If |
quiet |
If TRUE no output is printed. |
... |
Undocumented intent (preserved from legacy code) |
Details
If the runoff argument is set to TRUE
and no Condorcet winner exists,
two or more candidates with the most pairwise wins are selected and
the method is applied to such subset. If more than two candidates are in
such run-off, the selection is performed repeatedly, until either a winner
is selected or no more selection is possible.
The input data votes is structured the same way as for the stv method:
Row i
contains the preferences of voter i
numbered
1; 2; : : : ; r; 0; 0; 0; 0
, in some order, while equal preferences
are allowed. The columns correspond to the candidates. The dimnames of
the columns are the names of the candidates; if these are not supplied
then the candidates are lettered A, B, C, ...
. If the dataset
contains missing values (NA), they are replaced by zeros.
If a ballot has equally-ranked candidates, its rankings are tested for
validity: for each preference i
which does not have any duplicate,
there are exactly i - 1
preferences j
with 0 < j < i
. If
any ballot x
fails this validity test, it is automatically corrected (aka
"converted") into a valid ballot using x <- rank(x, ties.method = "min")
,
and a warning is issued.
This method also computes a Borda ranking of all candidates, using
tournament-style scoring. This ranking is "fuzzed" into a safeRank
, with
approximately 1 s.d. of fuzz when safety=1.0
and voter preferences are
i.u.d. A warning is thrown if a safeRank
violates the (extended) Condorcet
principle: that Candidate i
is more highly ranked than Candidate
j
only if a majority of voters agree with this.
Value
Object of class SafeVote.condorcet
Examples
{
data(food_election)
condorcet(food_election)
}