Pairwise counting: Difference between revisions

Reintroduced Condorcet loser as e.g. STAR passes it and uses pairwise counting. Summable contingent vote would also use it.
(Reintroduced Condorcet loser as e.g. STAR passes it and uses pairwise counting. Summable contingent vote would also use it.)
 
(11 intermediate revisions by 5 users not shown)
Line 1:
[[File:Pairwise counting with ranked ballot GIF.gif|thumb|576x576px|A GIF for pairwise counting with a [[ranked ballot]]. Click on the image and then the thumbnail of the image to see the animation.]]
'''Pairwise counting''' is the process of considering a set of items, comparing one pair of items at a time, and for each pair counting the comparison results. In the context of voting theory, it involves comparing pairs of candidates or winner sets (usually using majority rule) to determine the winner and loser of the [[Pairwise matchup|pairwise matchup]]. This is done by looking at voters' (usually [[Ranked ballot|ranked]] or [[Rated ballot|rated]]) ballots to count, for each pair of candidates, which one they indicated a preference for, if they did. The [[pairwise preference]] article discusses how pairwise comparison information can be used.
 
Most, but not all, election methods that meet the [[Condorcet criterion]] or the [[Condorcet loser criterion]] use pairwise counting.<ref group="nb">[[Nanson'sThe method|Nanson]]most meetscommon theexceptions are [[CondorcetComposite_methods|hybrid criterionmethods]] (e.g. Smith//X) and [[InstantSequential_loser-elimination_method|sequential-runoff voting]] meets the [[Condorcet loser-elimination criterionmethods]].</ref> See the [[Pairwise counting#Condorcet|Condorcet section]] for more information on the use of pairwise counting in [[Condorcet methods]].
 
== ExamplesProcedure ==
 
=== Example without numbersExamples ===
 
==== Example without numbers ====
As an example, if pairwise counting is used in an election that has three candidates named A, B, and C, the following pairwise counts are produced:
 
Line 52 ⟶ 53:
In general, for N candidates, there are 0.5*N*(N-1) pairwise matchups. For example, for 2 candidates there is one matchup, for 3 candidates there are 3 matchups, for 4 candidates there are 6 matchups, for 5 candidates there are 10 matchups, for 6 candidates there are 15 matchups, and for 7 candidates there are 21 matchups.
 
==== Example with numbers ====
 
{{Tenn_voting_example}}
Line 140 ⟶ 141:
|}
 
==== Example using various ballot types ====
 
[See [[:File:Pairwise counting procedure.png|File:Pairwise_counting_procedure.png]] for an image explaining all of this).
Line 146 ⟶ 147:
Suppose there are five candidates A, B, C, D and E.
 
===== Sufficiently expressive ballot types =====
 
====== Ranked ballots ======
Using ranked ballots, suppose two voters submit the ranked ballots A>B>C, which means they prefer A over B, B over C, and A over C, with all three of these ranked candidates being preferred over either D or E. This assumes that unranked candidates are ranked equally last.
 
====== Rated ballots ======
Now suppose the same two voters submit [[Rated voting|rated ballots]] of A:5 B:4 C:3, which means A is given a score of 5, B a score of 4, and C a score of 3, with D and E left blank. Pairwise preferences can be inferred from these ballots. Specifically A is scored higher than B, and B is scored higher than C. It is known that these ballots indicate that A is preferred over B, B over C, and A over C. If blank scores are assumed to mean the lowest score, which is usually a 0, then A and B and C are preferred over D and E.
 
Line 201 ⟶ 202:
([https://star.vote star.vote] offers the ability to see the pairwise matrix based off of rated ballots.)
 
===== Choose-oneInexpressive andballot Approval ballotstypes =====
 
====== Choose-one and Approval ballots ======
Pairwise counting also can technically be done using [[Choose-one voting]] ballots and [[Approval voting]] ballots (by giving one vote to the marked candidate in a matchup where only one of the two candidates was marked), but such ballots do not supply information to indicate that the voter prefers their 1st choice over their 2nd choice, that the voter prefers their 2nd choice over their 3rd choice, and so on.
 
===== Dealing with unmarked/last-place candidates =====
Note that when a candidate is unmarked it is generally treated as if the voter has no preference between the unmarked candidates (a candidate who is marked on the ballot is considered '''explicitly''' supported, and a candidate who is unmarked is '''implicitly''' unsupported). When the voter has no preference between certain candidates, which can also be seen by checking if the voter ranks/scores/marks multiple candidates in the same way (i.e. they say two candidates are both their 1st choice, or are both scored a 4 out of 5), then it is treated as if the voter wouldn't give a vote to any of those candidates in their matchups against each other.
 
=== Dealing with write-in candidates ===
[[File:Approaches for handling write-in candidates in pairwise counting.png|thumb|837x837px]]
The difficulty of handling [[Write-in candidate|write-in candidat]]<nowiki/>es depends on how a voter's preference between ranked and unranked candidates is counted.
 
# If the voter is treated as preferring ranked candidates over unranked candidates (which is the near-universal approach), then write-ins can be difficult to count using pairwise counting, because the vote-counters don't know who they are and thus can't directly record voter preferences in matchups between on-ballot mainstream candidates and write-in candidates.
A comprehensive approach is to, in each [[precinct]], count the number of ballots that explicitly rank each (non-write-in) candidate. When a write-in candidate is found on a ballot, then before that ballot is counted, the number of votes each non-write-in candidate gets against the write-in candidate is the number of ballots they were so far ranked on. The ballot is then counted, and the write-in candidate is treated as a non-write-in candidate from that point onwards (from the perspective of this algorithm). When the pairwise vote totals are summed up from each precinct, then if in one precinct a write-in candidate wasn't marked by any voters but in another they were, then similarly the number of votes each candidate in the first precinct is treated as getting against the write-in candidate are the number of ballots that ranked them in the first precinct. <ref>{{Cite web|url=https://electowiki.org/wiki/Talk:Condorcet_method|title=Condorcet method|date=2020-05-14|website=Electowiki|language=en|access-date=2020-05-14}}</ref><ref>{{Cite web|url=https://www.reddit.com/r/EndFPTP/comments/fsa4np/possible_solution_to_the_condorcet_writein_problem/fm7bgpd|title=r/EndFPTP - Comment by u/ASetOfCondors on ”Possible solution to the Condorcet write-in problem”|website=reddit|language=en-US|access-date=2020-05-14}}</ref>
# If the voter is treated as having no preference between ranked and unranked candidates, then there are no issues to consider with counting write-in candidates under the regular approach.
 
Below are some ways of dealing with write-ins if unranked candidates are treated in the first way described above.
The below-discussed negative counting approach automatically handles write-ins, and requires less markings than the above-mentioned approach when equal-rankings are counted as a vote for both candidates in a matchup.
 
==== Non-comprehensive approaches ====
==Notes==
[[File:Pairwise counting table with links between matchups.png|thumb|444x444px|Green arrows point from the loser of the matchup to the winner. Yellow arrows indicate a tie. Red arrows (not shown here) indicate the opposite of green arrows (i.e. who lost the matchup).For example, the B>A matchup points to A>B with a green arrow because A pairwise beats B (head-to-head).]]
 
* Write-in candidates can be banned. This is the usual approach.
=== Quicker ways to do pairwise counting ===
** Write-in candidates can be allowed to run, but with the caveat that only the pairwise preferences of ballots that rank them contribute votes in pairwise matchups featuring them.
Also see the negative vote-counting approach below, which can be quicker than the regular approach depending on how it's implemented.
*** A slight modification is to comprehensively count only those write-in candidates who are ranked on a significant number of ballots i.e. two rounds of counting may be necessary in each precinct sometimes, one to determine how many ballots write-ins are ranked on, and a second for the major write-ins.
 
==== Comprehensive approaches ====
These approaches collect all of the pairwise information for write-in candidates i.e. there would be no change in vote totals if the write-in candidate suddenly became one of the on-ballot candidates.
 
* In each [[precinct]], count the number of ballots that explicitly rank each (non-write-in) candidate. When a write-in candidate is found on a ballot, then before that ballot is counted, give each non-write-in candidate a number of votes against the write-in equal to the number of ballots where that non-write-in candidate was explicitly ranked. Then count the ballot and treat the write-in candidate as a non-write-in candidate from that point onwards (from the perspective of this algorithm).
**When creating a precinct subtotal, also record, for each candidate, how many ballots that candidate was explicitly ranked on.
**When combining the pairwise vote totals from each precinct, then if in one precinct a write-in candidate wasn't marked by any voters but in another they were, then similarly treat all the ballots from the first precinct to rank every explicitly ranked candidate above the write-in: for each candidate in the first precinct, against the write-in in the second, add the number of voters in the first precinct who explicitly ranked that non-write-in candidate. <ref>{{Cite web|url=https://electowiki.org/wiki/Talk:Condorcet_method|title=Condorcet method|date=2020-05-14|website=Electowiki|language=en|access-date=2020-05-14}}</ref><ref>{{Cite web|url=https://www.reddit.com/r/EndFPTP/comments/fsa4np/possible_solution_to_the_condorcet_writein_problem/fm7bgpd|title=r/EndFPTP - Comment by u/ASetOfCondors on ”Possible solution to the Condorcet write-in problem”|website=reddit|language=en-US|access-date=2020-05-14}}</ref>
* The [[Pairwise counting#Negative vote-counting approach|negative vote-counting approach]] automatically handles write-ins, and requires less markings than the above-mentioned approach when explicit equal-rankings are counted as a vote for both candidates in a matchup. However, it requires a post-processing stage to convert the Condorcet matrix into the more familiar form before usage by Condorcet methods.
 
==Count complexity==
==== Sequentially examining each rank on a voter's ballot ====
[[File:Pairwise counting with ranked ballot GIF.gif|thumb|576x576px|A GIF for pairwise counting with a [[ranked ballot]], which shows how to sequentially count it one rank at a time. Click on the image and then the thumbnail of the image to see the animation.]]The naive way of counting pairwise preferences implies determining, for each pair of candidates, and for each voter, if that voter prefers the first candidate of the pair to the second or vice versa. This requires looking at ballots <math>O(Vc^2)</math> times.
The naive way of counting pairwise preferences implies determining, for each pair of candidates, and for each voter, if that voter prefers the first candidate of the pair to the second or vice versa. This requires looking at ballots <math>O(Vc^2)</math> times. If reading a ballot takes a lot of time, it's possible to reduce the number of times a ballot has to be consulted by noting that if a voter ranks X first, he prefers X to everybody else; if he ranks Y second, he prefers Y to everybody but X, and so on. The Condorcet matrix still has to be updated <math>O(Vc^2)</math> times, but a ballot only has to be consulted <math>Vc</math> times at most. If the voters only rank a few preferences, that further reduces the counting time.
 
If reading a ballot takes a lot of time, it's possible to reduce the number of times a ballot has to be consulted by noting that:
 
* if a voter ranks X first, he prefers X to everybody else
* if he ranks Y second, he prefers Y to everybody but X
 
and so on. In other words, a ballot can be more quickly counted by examining candidates in each of its ranks sequentially from the highest rank on downward. The pairwise matrix still has to be updated <math>O(Vc^2)</math> times, but a ballot only has to be consulted <math>Vc</math> times at most. If the voters only rank a few preferences, that further reduces the counting time.
 
A special case of this speedup is to separately record the first preferences of each ballot, as in a [[First_past_the_post]] count. A voter who ranks a candidate X uniquely first must rank X above every other candidate and no other candidate above X, so there's no need to look at Y>X preferences at all.
 
===== Uses for first choice information =====
(This actually collects more information than the usual pairwise approach; specifically, if no voters equally rank candidates 1st, then it is possible to determine who the [[FPTP]] winner is, and further, if it can be determined that there is only one candidate in the [[Dominant mutual third set]], then that candidate is the [[IRV]] winner.)
 
=== Techniques for when one is collecting both rated and pairwise information ===
If using pairwise counting for a [[rated method]], one helpful trick is to put the rated information for each candidate in the cell where each candidate is compared to themselves. For example, if A has 50 points (based on a [[Score voting]] ballot), B has 35 points, and C has 20, then this can be represented as:
{| class="wikitable"
Line 251 ⟶ 278:
Pairwise counting can be used to tally the results of [[Choose-one voting]], [[Approval voting]], and [[Score voting]]; in these methods, a voter is interpreted as giving a degree of support to each candidate in a matchup, which can be reflected either using margins or (in the case of Score) the voter's support for both candidates in the matchup. See [[rated pairwise preference ballot#Margins and winning votes approaches]] for an example.
 
==Negative vote-counting approach==
=== Defunct sections ===
See [[Negative vote-counting approach for pairwise counting]] for an alternative way to do pairwise counting. The negative counting approach can be faster than the approach outlined in this article in some cases; for example, a voter who votes A>B when there are 10 candidates requires 9+8=17 markings to be made to count their ballot under the usual approach, but only 3 in the negative counting approach.
 
== Defunct sections ==
These sections were at one time part of this particle, but have been shifted to the [[Pairwise preference]] article. They are kept here only to avoid breaking any links pointing to them.
 
==== Election examples ====
See [[Pairwise preference#Election examples]]
 
====Terminology ====
See [[Pairwise preference#Definitions]].
 
====Condorcet====
See [[Pairwise preference#Condorcet]].
 
====Cardinal methods ====
See [[Pairwise preference#Strength of preference]] and [[rated pairwise preference ballot]].
 
===Notes===
==Negative vote-counting approach==
Image to right shows interpretation of ranked ballot.
[[File:Negative vote-counting approach to pairwise counting.png|thumb|1114x1114px|Negative vote-counting approach for pairwise counting (Note: Regular approach may be better in some use cases; see cited discussions in text to the left).]]
[[File:Pairwise counting negative counting with ranked ballot GIF.gif|thumb|454x454px|GIF for negative counting. Click on the image and then the thumbnail of the image to see the animation.]]There are two steps to the negative counting approach: the information captured by the vote-counters, and the math done to find the final result.
 
# Vote-counting: The precinct vote-counters count the following values for a given candidate:
#* The number of voters who ranked/rated/marked a candidate on their ballot.
#* In each head-to-head matchup, the number of voters who ''explicitly'' ranked that candidate '''below''' the other candidate ("explicitly" meaning they also marked both candidates on their ballot).
# Math: The final number of votes for the first candidate against the second candidate in each head-to-head matchup is then found by subtracting the second value for the first candidate from the first value.
 
The ballots marking each candidate can be placed in the blank cell comparing themselves to themselves in the pairwise matrix i.e. for candidate A, the cell A>A would contain the number of voters ranking A.<ref>{{Cite web|url=https://www.reddit.com/r/EndFPTP/comments/fsa4np/possible_solution_to_the_condorcet_writein_problem/|title=Possible solution to the Condorcet write-in problem|last=|first=|date=|website=|url-status=live|archive-url=|archive-date=|access-date=}}</ref>
 
'''Note''': When using this approach, there is an important caveat when dealing with voters who explicitly rank two candidates equally; see the [[#Dealing with equal-ranking]] section below.
 
=== Example ===
If 10 voters vote A>B and 5 voters vote B, then A is explicitly marked on 10 ballots and B on 15, with B being explicitly ranked below A on 10 ballots, and A being explicitly ranked below B on 0 ballots. The number of votes in favor of each candidate is then:
 
* A>B is (10-0)=10 votes.
* B>A is (15-10)=5 votes.
 
=== Dealing with equal-ranking ===
The negative counting approach, depending on implementation, can require even more markings when equal-ranking is allowed, and it is desired to have comprehensive vote totals, rather than only information about who won, tied, or lost each matchup (i.e. the pairwise [[margins]]). This is because if there are 2 candidates A and B, with the votes being: <blockquote>2 A>B
 
1 B>A
 
5 A=B </blockquote>then either it can be marked that A wins against B by:
 
* 2 votes to 1
* 7 votes to 6
 
This is because the voters who equally ranked A and B can be considered to, in the A vs B matchup, either be voting for:
 
* Neither of them (similar to [[FPTP|choose-one FPTP voting]]; this is the traditional pairwise counting approach).
* Both of them (similar to [[Approval voting]]).
 
This is related to how, in [[Approval voting]], if A has 30 approvals and B 20, and no other information is supplied, then it is impossible to know whether the 20 voters who approved B also approved A or not. This can change who wins if using the [[Winning votes|winning-votes]] version of a [[:Category:Defeat-dropping Condorcet methods|Category:Defeat-dropping Condorcet method]], because not only does it matter who wins the matchup, but also exactly how many voters genuinely preferred the winner to the loser.
 
==== Example of the two approaches to equal-ranking ====
If a voter had ranked 9 of 10 candidates as their 1st choices, and the 10th candidate was unranked (i.e. implicitly ranked last), then at least 9 marks must be made in both approaches, to indicate that 1 voter has ranked each of the 9 candidates who are the voter's 1st choice. In addition:
 
===== Explicitly equal-ranked candidates both get a vote =====
No extra work needs to be done.
 
===== Equal-ranked candidates don't get votes =====
For each matchup, the following number of markings can be made for two candidates A and B:
 
* 2 markings can be made (1 negative vote for A>B and 1 for B>A). (Note that in essence, this approach involves counting the number of voters who explicitly ranked a given candidate '''below''' '''<big>or equal</big>''' to the other candidate, rather than only '''below'''.)
* 1 negative marking can be made for the A vs B matchup in general, which is later interpreted as a negative vote for both candidates.
 
In this example, there are 0.5*(9*8)=0.5*72='''36''' matchups to count between equally-ranked candidates. Accordingly, either 36*2='''72''' or '''36''' markings can be made.
 
=== Dealing with last-place candidates ===
It is not necessary to mark that a voter ranked a candidate if they ranked that candidate as their last choice, because this means they wouldn't vote for that candidate in any matchups.
 
==== Write-in candidates ====
This advice is less relevant when write-ins are allowed, however, because even if a voter ranks a candidate last among the candidates named on their ballot, they are still implicitly ranking that candidate above all of the write-in candidates they didn't rank on their ballot.
 
=== Comparison to the regular approach ===
Comparison between the regular approach and negative counting:
 
* '''The regular approach''': The precinct vote-counters manually count all of the voter's preferences in each head-to-head matchup; in other words, a candidate is assumed to be preferred only in the matchups where the vote-counters mark them as being so.
** This can be slow, and also can make it difficult to accommodate write-in candidates (see the above section), since the vote-counters won't know ahead of time who those candidates are, and thus won't be able to indicate preferences in those matchups.
* '''Negative counting approach''': The vote-counters mark a candidate as being ranked on a ballot, assume the voter who marked them prefers that candidate in every matchup, and then show which matchups this is not true for.
 
Note that this negative counting is faster when voters rank only a few of all candidates, and potentially slower otherwise. For example, a voter who votes A>B when there are 10 candidates can be assumed to vote for A and B in every matchup, except they don't prefer B>A. Usually, this would require manually marking those positive preferences, resulting in 9 marks to show A being preferred to all other candidates, and 8 marks to show B preferred to all candidates except A. But negative counting only requires 3 marks: 1 each for A and B to indicate they are preferred in every matchup, and 1 to indicate that this isn't the case for B>A.
 
=== Connection to cardinal methods ===
This approach can be considered an [[Approval voting]]-based or [[cardinal]] approach, because when explicit equal-rankings are counted as a vote for both candidates in the matchup, then each voter that votes Approval-style (i.e. explicitly ranks some candidates 1st and all others implicitly last) will have their ballot counted like an [[Approval ballot]] (i.e. all approved candidates receive one mark, and all disapproved candidates receive no marks).
==== Using with strength of preference ====
Negative vote-counting can be used to count weak pairwise preferences (i.e. if a voter only wants to give 0.4 votes in a matchup, rather than 1 vote; see [[Rated pairwise preference ballot#Implementations]]) by counting only a "partial ballot" marking a candidate, and partial (i.e. weighted or fractional) negative votes in certain matchups. In other words, it is treated as if only a partial voter supported a candidate (see [[KP transform]]).
 
==References==
<references />
 
==Notes==
[[Category:Majority-related concepts]]
<references group="nb" />
 
[[Category:Majority–minority relations]]
[[Category:Condorcet-related concepts]]
 
<references group="nb" />
1,204

edits