Pairwise counting: Difference between revisions

From electowiki
Content added Content deleted
(Reintroduced Condorcet loser as e.g. STAR passes it and uses pairwise counting. Summable contingent vote would also use it.)
 
(43 intermediate revisions by 6 users not shown)
Line 1: Line 1:
'''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]].
'''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's method|Nanson]] meets the [[Condorcet criterion]] and [[Instant-runoff voting]] meets the [[Condorcet loser criterion]].</ref> See the [[Pairwise counting#Condorcet|Condorcet section]] for more information on the use of pairwise counting in [[Condorcet methods]].
Most, but not all, election methods that meet the [[Condorcet criterion]] or the [[Condorcet loser criterion]] use pairwise counting.<ref group="nb">The most common exceptions are [[Composite_methods|hybrid methods]] (e.g. Smith//X) and [[Sequential_loser-elimination_method|sequential-loser-elimination methods]].</ref> See the [[Pairwise counting#Condorcet|Condorcet section]] for more information on the use of pairwise counting in [[Condorcet methods]].


== Example without numbers ==
== Procedure ==

=== Examples ===

==== 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:
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 19: Line 23:


If the number of voters who have no preference between two candidates is not supplied, it can be calculated using the supplied numbers. Specifically, start with the total number of voters in the election, then subtract the number of voters who prefer the first over the second, and then subtract the number of voters who prefer the second over the first.
If the number of voters who have no preference between two candidates is not supplied, it can be calculated using the supplied numbers. Specifically, start with the total number of voters in the election, then subtract the number of voters who prefer the first over the second, and then subtract the number of voters who prefer the second over the first.

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.


These counts can be arranged in a ''pairwise comparison matrix''<ref name=":0">{{Cite book|url=https://books.google.com/?id=q2U8jd2AJkEC&lpg=PA6&pg=PA6|title=Democracy defended|last=Mackie, Gerry.|date=2003|publisher=Cambridge University Press|isbn=0511062648|location=Cambridge, UK|pages=6|oclc=252507400}}</ref> or ''outranking matrix<ref>{{Cite journal|title=On the Relevance of Theoretical Results to Voting System Choice|url=http://link.springer.com/10.1007/978-3-642-20441-8_10|publisher=Springer Berlin Heidelberg|work=Electoral Systems|date=2012|access-date=2020-01-16|isbn=978-3-642-20440-1|pages=255–274|doi=10.1007/978-3-642-20441-8_10|first=Hannu|last=Nurmi|editor-first=Dan S.|editor-last=Felsenthal|editor2-first=Moshé|editor2-last=Machover}}</ref>'' table (though it could simply be called the "candidate head-to-head matchup table") such as below.
These counts can be arranged in a ''pairwise comparison matrix''<ref name=":0">{{Cite book|url=https://books.google.com/?id=q2U8jd2AJkEC&lpg=PA6&pg=PA6|title=Democracy defended|last=Mackie, Gerry.|date=2003|publisher=Cambridge University Press|isbn=0511062648|location=Cambridge, UK|pages=6|oclc=252507400}}</ref> or ''outranking matrix<ref>{{Cite journal|title=On the Relevance of Theoretical Results to Voting System Choice|url=http://link.springer.com/10.1007/978-3-642-20441-8_10|publisher=Springer Berlin Heidelberg|work=Electoral Systems|date=2012|access-date=2020-01-16|isbn=978-3-642-20440-1|pages=255–274|doi=10.1007/978-3-642-20441-8_10|first=Hannu|last=Nurmi|editor-first=Dan S.|editor-last=Felsenthal|editor2-first=Moshé|editor2-last=Machover}}</ref>'' table (though it could simply be called the "candidate head-to-head matchup table") such as below.
Line 49: Line 51:
Note that since a candidate can't be pairwise compared to themselves (for example candidate A can't be compared to candidate A), the cell that indicates this comparison is always empty.
Note that since a candidate can't be pairwise compared to themselves (for example candidate A can't be compared to candidate A), the cell that indicates this comparison is always empty.


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.
To identify which candidate wins a specific pairwise matchup, such as between candidates A and B, subtract the value of B>A from A>B. If the resulting value is positive, then candidate A won the matchup. If it is zero, then there is a pairwise tie. If the result is negative, then candidate B won the matchup. (See the [[Pairwise counting#Terminology|Terminology]] section for details.)

Sometimes only the "dominance relation" (wins, losses, and ties) is shown, rather than the exact numbers. So for example, if A beat B in their pairwise matchup, it'd be possible to write "Win" (or a green checkmark) in the A>B cell and "Loss" (or a red X) in the B>A cell.


== Example with numbers ==
==== Example with numbers ====


{{Tenn_voting_example}}
{{Tenn_voting_example}}
Line 141: Line 141:
|}
|}


== Example using various ballot types ==
==== Example using various ballot types ====


[See [[:File:Pairwise counting procedure.png|File:Pairwise_counting_procedure.png]], which appears in the [[Pairwise counting#Notes|Notes]] section, for an image explaining all of this).
[See [[:File:Pairwise counting procedure.png|File:Pairwise_counting_procedure.png]] for an image explaining all of this).


Suppose there are five candidates A, B, C, D and E.
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.
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.
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 198: Line 202:
([https://star.vote star.vote] offers the ability to see the pairwise matrix based off of rated ballots.)
([https://star.vote star.vote] offers the ability to see the pairwise matrix based off of rated ballots.)


===== Inexpressive ballot types =====
Pairwise counting also can 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.


====== Choose-one and Approval ballots ======
Note that when a candidate is unmarked it is generally treated as if the voter has no preference between the unmarked candidates. 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.
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 =====
== Election examples ==
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.
Here is an example of a pairwise victory table for the [https://en.wikipedia.org/wiki/2009_Burlington_mayoral_election Burlington 2009] election:
{| class="wikitable"
| colspan="3" rowspan="2" |&nbsp;
|&nbsp;
|&nbsp;
|&nbsp;
|&nbsp;
|&nbsp;
|&nbsp;
|-
!wi
!JS
! DS
!KW
!BK
!AM
|-
!&nbsp;
!AM
| colspan="6" |Andy
Montroll (5–0)
|5 Wins ↓
|-
!&nbsp;
!BK
| colspan="5" |Bob
Kiss (4–1)
|1 Loss →
↓ 4 Wins
| 4067 (AM) –
3477 (BK)
|-
!&nbsp;
!KW
| colspan="4" |Kurt
Wright (3–2)
|2 Losses →
3 Wins ↓
|4314 (BK) –
4064 (KW)
| 4597 (AM) –
3668 (KW)
|-
!&nbsp;
!DS
| colspan="3" | Dan
Smith (2–3)
|3 Losses →
2 Wins ↓
| 3975 (KW) –
3793 (DS)
|3946 (BK) –
3577 (DS)
|4573 (AM) –
2998 (DS)
|-
!&nbsp;
!JS
| colspan="2" |James
Simpson (1–4)
|4 Losses →
1 Win ↓
| 5573 (DS) –
721 (JS)
|5274 (KW) –
1309 (JS)
|5517 (BK) –
845 (JS)
|6267 (AM) –
591 (JS)
|-
|&nbsp;
!wi
|Write-in (0–5)
| 5 Losses →
|3338 (JS) –
165 (wi)
|6057 (DS) –
117 (wi)
|6063 (KW) –
163 (wi)
|6149 (BK) –
116 (wi)
|6658 (AM) –
104 (wi)
|}To read this, take for example the cell where BK is compared to AM (the cell with BK on the left and AM on the top); "4067 (AM)" means that 4067 voters preferred AM (Andy Montroll) over BK (Bob Kiss), and "3477 (BK)" means that 3477 voters preferred BK over AM. Because AM got more votes than BK in that matchup, AM won that matchup.
== Terminology ==
The following terms are often used when discussing pairwise counting:


=== Dealing with write-in candidates ===
'''Pairwise matchup''': Also known as a head-to-head matchup, it is when voters are asked to indicate their preference between two candidates or winner sets, with the one that voters prefer winning. It is usually done on the basis of majority rule (i.e. if more voters prefer one candidate over the other than the number of voters who have the opposing preference, then the candidate preferred by more voters wins the matchup) using [[Choose-one voting|choose-one voting]], though see the [[Pairwise counting#Cardinal methods|Cardinal methods]] section for alternative ways. Pairwise matchups can be simulated from ranked or rated ballots and then assembled into a table to show all of the matchups simultaneously; see above.
[[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.
'''Pairwise win/beat''' and '''pairwise lose/defeated''': When one candidate receives more votes in a pairwise matchup/comparison against another candidate, the former candidate "pairwise beats" the latter candidate, and the latter candidate "pairwise loses." Often this is represented by writing "Pairwise winner>Pairwise loser"; this can be extended to show a [[beatpath]] by showing, for example, "A>B>C>D", which means A pairwise beats B, B pairwise beats C, and C pairwise beats D (though it may or may not be the case, depending on the context, that, for example, A pairwise beats C).
# 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.
'''Pairwise winner''' and '''pairwise loser''': The candidate who pairwise wins a matchup is the pairwise winner of the matchup (not to be confused with the pairwise champion; see the definition two spots below). The other candidate is the pairwise loser of the matchup. (Note that sometimes "pairwise loser" is also used to refer to a [[Condorcet loser]], which is a candidate who is pairwise defeated in all of their matchups).


==== Non-comprehensive approaches ====
'''Pairwise tie''': Occurs when two candidates receive the same number of votes in their pairwise matchup. (Note that sometimes it is also called a tie when there is pairwise cycling, though this is different; see the definition two spots below.)


* Write-in candidates can be banned. This is the usual approach.
'''Pairwise champion''': Also known as a beats-all winner or [[Condorcet winner]], it is a candidate who pairwise beats every other candidate. Due to pairwise ties (see above) and pairwise cycling (see below), there is not always a pairwise champion.
** 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.
*** 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 ====
'''Pairwise cycling:''' Also known as a [[Condorcet cycle]], it is when within a set of candidates, each candidate has at least one pairwise defeat (when looking only at the matchups between the candidates in the set). Note that some cycles can be symmetrical i.e. you can swap the candidates' names without changing the result. (See the [[Condorcet paradox]] article for an example, and the [[Neutrality criterion|neutrality criterion]] for more information). Such cycles are sometimes called ties.
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).
'''Minimal pairwise dominant set''': Also known as the [[Smith set]], it is the smallest group of candidates who pairwise beat all others. The [[Pairwise champion|pairwise champion]] will always be the only member of this set when they exist.
**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==
'''Pairwise order/ranking''': Also known as a [[Condorcet ranking]], it is a ranking of candidates such that each candidate is ranked above all candidates they pairwise beat. Sometimes such a ranking does not exist due to the [[Condorcet paradox]]. As a related concept, there is always a [[Smith set ranking|Smith ranking]] that applies to groups of candidates, and which reduces to the Condorcet ranking when one exists.
==== 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.


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:
== Condorcet ==
In a pairwise comparison matrix/table, often the color green is used to shade cells where more voters prefer the former candidate over the latter candidate than the other way around, the color red is used to shade cells where more voters prefer the latter candidate over the former candidate than the other way around, and some other color (often gray, yellow, or uncolored) is used to shade cells where as many voters prefer one candidate over the other as the other way around (pairwise ties).


* if a voter ranks X first, he prefers X to everybody else
Pairwise comparison tables are often ordered to create a [[Smith set ranking|Smith ranking]] of candidates, such that the candidates at the top [[Pairwise counting#Terminology|pairwise beat]] all candidates further down the table, all candidates directly below the candidates at the top pairwise beat all candidates further down the table, etc.
* 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.
In the context of [[Condorcet methods]]:


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.
- A [[Condorcet winner]] is a candidate for whom all their cells are shaded green.


===== Uses for first choice information =====
- The [[Smith set]] is the smallest group of candidates such that all of their cells are shaded green except some of the cells comparing each of the candidates in the group to each other.
(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 ==
- The [[Schwartz set]] is the same as the Smith set except some of their cells may be shaded the color for pairwise ties.
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:

- A [[Condorcet loser criterion|Condorcet loser]] is a candidate for whom all their cells are shaded red.

- The '''weak Condorcet winners''' and '''weak Condorcet losers''' are candidates for whom all of their cells are shaded either green (for the weak Condorcet winners) or red (for the weak Condorcet losers) or the color for pairwise ties.
== Cardinal methods ==
[[File:Pairwise relations Score.png|thumb|Pairwise matchups done using Score voting to indicate strength of preference in each matchup.]]

Cardinal methods can be counted using pairwise counting by comparing the difference in scores (strength of preference) between the candidates.

See the [[Order theory#Strength of preference]] article for more information. Essentially, instead of doing a pairwise matchup on the basis that a voter must give one vote to either candidate in the matchup or none whatsoever, a voter could be allowed to give something in between (a partial vote) or even one vote to both candidates in the matchup (which has the same effect on deciding which of them wins the matchup as giving neither of them a vote, as it does not help one of them get more votes than the other).

The Smith set is then always full of candidates who are at least weak Condorcet winners i.e. tied for having the most points/approvals. Note that this is not the case if voters are allowed to have preferences that wouldn't be writeable on a cardinal ballot i.e. if the max score is 5, and a voter indicates their 1st choice is 5 points better than their 2nd choice, and that their 2nd choice is 5 points better than their 3rd choice, then this would not be an allowed preference in cardinal methods, and thus it would be possible for a Condorcet cycle to occur. Also, if a voter indicates their 1st choice is 2 points better than their 2nd choice, that this likely automatically implies their 1st choice must be at least 2 points better than their 3rd choice, etc. So there seems to be a transitivity of strength of preference, just as there is a transitivity of preference for rankings. <ref>https://www.reddit.com/r/EndFPTP/comments/fcexg4/score_but_for_every_pairwise_matchup/</ref>

Note that when designing a ballot to allow voters to indicate strength of preference in pairwise matchups, it could be done by allowing the voters to rank or score the candidates themselves, and then indicate "between your 1st choice(s) and 2nd choice(s), what scores would you give to each in a pairwise matchup?" or "between the candidates you scored (max score) and the candidates you scored (max score - 1), what scores would you give in their pairwise matchups?", etc. Here is an example of one such setup: https://www.reddit.com/r/EndFPTP/comments/fcz3xd/poll_for_2020_dem_primary_using_scored_pairwise/<nowiki/> and some discussion: https://www.reddit.com/r/EndFPTP/comments/fimqpv/comment/fkkldcl?context=1

Another way of designing pairwise matchups to incorporate strength of preference is to allow the voter to indicate, for each pair of candidates, how they would score both of the candidates.

==Notes==
[[File:Pairwise counting procedure.png|thumb|The procedure for pairwise counting with various ballot formats and examples.]]When looking at two candidates, a quick way to figure out the number of votes for the first candidate>second candidate and vice versa is to first locate the cell for "first candidate>second candidate", count the minimum number of cells diagonally one must go to be adjacent to the middle dividing line of the matrix (where there is a --- cell), and then going one cell further diagonally (meaning you'll be starting from the closest cell on the opposite side of that dividing line), go that number of cells further diagonally to reach the other cell. For example:
{| class="wikitable"
{| class="wikitable"
|+
!
!
!A
! A
!B
! B
!C
! C
!D
!E
|-
|-
|A
|A
|'''50 points'''
| ---
| A>B
|2
|2
|A>C
|'''2'''
|2
|-
|-
|B
|B
|0
|B>A
|'''50 points'''
| ---
|2
|B>C
|2
|2
|-
|-
|C
|C
|0
|C>A
|0
|C>B
|'''50 points'''
| ---
|2
|}
This reduces the amount of space required to store and demonstrate all of the relevant information for calculating the result of the voting method.
|2
|-
|D
|''<u>0</u>''
|0
|0
| ---
|0
|-
|E
|0
|0
|0
|0
| ---
|}Try locating A>D (the fifth cell in the second row). To find the reverse, D>A, first you check and see that you have to go one cell down and to the left to be adjacent to the middle dividing line. Then, starting from the cell one cell down and to the left of the middle dividing line, go one cell further down and to the left to reach D>A. In doing this, you would start at A>D, go down to B>C, then jumping over the middle dividing line to C>B, go down to D>A.


=== Pairwise counting used in unorthodox contexts ===
Multi-winner methods that use pairwise counting, such as [[CPO-STV]] and [[Schulze STV]], instead of doing pairwise matchups between individual candidates, do pairwise matchups between sets of candidates (called winner sets).
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.
One of the notable aspects of pairwise counting is that it can be used to find a Condorcet winner or member of the Smith set in a simple manner without needing to be done with written ballots; see [[:Category:Sequential comparison Condorcet methods]] for more information.{{reflist|group=nb}}


==Negative vote-counting approach==
== References ==
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===
Image to right shows interpretation of ranked ballot.
==References==
<references />
<references />


==Notes==
[[Category:Majority-related concepts]]
<references group="nb" />

[[Category:Majority–minority relations]]
[[Category:Condorcet-related concepts]]
[[Category:Condorcet-related concepts]]

Latest revision as of 12:45, 22 February 2024

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. This is done by looking at voters' (usually ranked or 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.[nb 1] See the Condorcet section for more information on the use of pairwise counting in Condorcet methods.

Procedure

Examples

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:

  • Number of voters who prefer A over B
  • Number of voters who prefer B over A
  • Number of voters who have no preference for A versus B
  • Number of voters who prefer A over C
  • Number of voters who prefer C over A
  • Number of voters who have no preference for A versus C
  • Number of voters who prefer B over C
  • Number of voters who prefer C over B
  • Number of voters who have no preference for B versus C

Alternatively, the words "Number of voters who prefer A over B" can be interpreted as "The number of votes that help A beat (or tie) B in the A versus B pairwise matchup".

If the number of voters who have no preference between two candidates is not supplied, it can be calculated using the supplied numbers. Specifically, start with the total number of voters in the election, then subtract the number of voters who prefer the first over the second, and then subtract the number of voters who prefer the second over the first.

These counts can be arranged in a pairwise comparison matrix[1] or outranking matrix[2] table (though it could simply be called the "candidate head-to-head matchup table") such as below.

Pairwise counts
A B C
A A > B A > C
B B > A B > C
C C > A C > B

In cases where only some pairwise counts are of interest, those pairwise counts can be displayed in a table with fewer table cells.

Note that since a candidate can't be pairwise compared to themselves (for example candidate A can't be compared to candidate A), the cell that indicates this comparison is always empty.

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

Tennessee's four cities are spread throughout the state
Tennessee's four cities are spread throughout the state

Imagine that Tennessee is having an election on the location of its capital. The population of Tennessee is concentrated around its four major cities, which are spread throughout the state. For this example, suppose that the entire electorate lives in these four cities, and that everyone wants to live as near the capital as possible.

The candidates for the capital are:

  • Memphis, the state's largest city, with 42% of the voters, but located far from the other cities
  • Nashville, with 26% of the voters, near the center of Tennessee
  • Knoxville, with 17% of the voters
  • Chattanooga, with 15% of the voters

The preferences of the voters would be divided like this:

42% of voters
(close to Memphis)
26% of voters
(close to Nashville)
15% of voters
(close to Chattanooga)
17% of voters
(close to Knoxville)
  1. Memphis
  2. Nashville
  3. Chattanooga
  4. Knoxville
  1. Nashville
  2. Chattanooga
  3. Knoxville
  4. Memphis
  1. Chattanooga
  2. Knoxville
  3. Nashville
  4. Memphis
  1. Knoxville
  2. Chattanooga
  3. Nashville
  4. Memphis

These ranked preferences indicate which candidates the voter prefers. For example, the voters in the first column prefer Memphis as their 1st choice, Nashville as their 2nd choice, etc. As these ballot preferences are converted into pairwise counts they can be entered into a table.

The following square-grid table displays the candidates in the same order in which they appear above.

Square grid
... over Memphis ... over Nashville ... over Chattanooga ... over Knoxville
Prefer Memphis ... - 42% 42% 42%
Prefer Nashville ... 58% - 68% 68%
Prefer Chattanooga ... 58% 32% - 83%
Prefer Knoxville ... 58% 32% 17% -

The following tally table shows another table arrangement with the same numbers.

Tally table
All possible pairs
of choice names
Number of votes with indicated preference Margin
Prefer X over Y Equal preference Prefer Y over X
X = Memphis
Y = Nashville
42% 0 58% -16%
X = Memphis
Y = Chattanooga
42% 0 58% -16%
X = Memphis
Y = Knoxville
42% 0 58% -16%
X = Nashville
Y = Chattanooga
68% 0 32% +36%
X = Nashville
Y = Knoxville
68% 0 32% +36%
X = Chattanooga
Y = Knoxville
83% 0 17% +66%

Example using various ballot types

[See File:Pairwise_counting_procedure.png for an image explaining all of this).

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 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.

In a pairwise comparison table, this can be visualized as (organized by Copeland ranking):

A B C D E
A --- 2 2 2 2
B 0 --- 2 2 2
C 0 0 --- 2 2
D 0 0 0 --- 0
E 0 0 0 0 ---

(star.vote offers the ability to see the pairwise matrix based off of rated ballots.)

Inexpressive ballot types
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

The difficulty of handling write-in candidates depends on how a voter's preference between ranked and unranked candidates is counted.

  1. 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.
  2. 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.

Non-comprehensive approaches

  • Write-in candidates can be banned. This is the usual approach.
    • 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.
      • 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. [3][4]
  • The 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

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 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. 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 times, but a ballot only has to be consulted 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:

A B C
A 50 points A>B A>C
B B>A 50 points B>C
C C>A C>B 50 points

This reduces the amount of space required to store and demonstrate all of the relevant information for calculating the result of the voting method.

Pairwise counting used in unorthodox contexts

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

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

Image to right shows interpretation of ranked ballot.

References

  1. Mackie, Gerry. (2003). Democracy defended. Cambridge, UK: Cambridge University Press. p. 6. ISBN 0511062648. OCLC 252507400.
  2. Nurmi, Hannu (2012). Felsenthal, Dan S.; Machover, Moshé (eds.). "On the Relevance of Theoretical Results to Voting System Choice". Electoral Systems. Springer Berlin Heidelberg: 255–274. doi:10.1007/978-3-642-20441-8_10. ISBN 978-3-642-20440-1. Retrieved 2020-01-16.
  3. "Condorcet method". Electowiki. 2020-05-14. Retrieved 2020-05-14.
  4. "r/EndFPTP - Comment by u/ASetOfCondors on "Possible solution to the Condorcet write-in problem"". reddit. Retrieved 2020-05-14.

Notes

  1. The most common exceptions are hybrid methods (e.g. Smith//X) and sequential-loser-elimination methods.