User:Psephomancy/2D election simulation examples

From electowiki

This is an example simulation of an election on a 2-dimensional political spectrum (such as the Political Compass, Nolan chart, Pournelle chart, etc.; it doesn't matter what the actual axes are.)

There are 3000 voters (black dots), 3 candidates (colored dots), and voters vote honestly, supporting the candidates who are most similar to them ideologically (nearest distance).

  • C (green) is a partisan candidate on the right
  • A (blue) is another partisan candidate, this time on the left
  • B (orange) is a moderate candidate, and the best representative of the average voter

FPTP

C wins under first-past-the-post voting, since A and B split the votes of the left wing of the electorate. (If A hadn't run, then B would have won. If B hadn't run, then A would have won. But since they both ran in the same election, C won instead.)

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Votes","format":"d"}],"data":[{"format":{"parse":{"y":"integer","x":"string"},"type":"json"},"name":"chart","values":[{"y":1031,"series":"y","x":"A"},{"y":861,"series":"y","x":"B"},{"y":1108,"series":"y","x":"C"}]}],"width":200}</graph>

IRV ("RCV") / Exhaustive Ballot

A wins under Instant-Runoff Voting ("Ranked-Choice Voting"), after B is eliminated for not having enough first-preference votes, leaving A and C. (A is slightly closer to the center, so more people in the center support A over C.)

First round is the same as plurality:

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Votes","format":"d"}],"data":[{"format":{"parse":{"y":"integer","x":"string"},"type":"json"},"name":"chart","values":[{"y":1031,"series":"y","x":"A"},{"y":861,"series":"y","x":"B"},{"y":1108,"series":"y","x":"C"}]}],"width":200}</graph>


Second round after B is eliminated:

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Votes","format":"d"}],"data":[{"format":{"parse":{"y":"integer","x":"string"},"type":"json"},"name":"chart","values":[{"y":1619,"series":"y","x":"A"},{"y":0,"series":"y","x":"B"},{"y":1381,"series":"y","x":"C"}]}],"width":200}</graph> Exhaustive ballot behaves the same way, since it uses the same elimination rule as IRV, only held using multiple single-mark ballot runoffs instead of using a ranked ballot.

Top-two runoff / Open primary / Contingent Vote

A wins under top-two runoff or an open primary. A and C have the most votes and proceed to the runoff. (None of the candidates gets over 50% in the first round.) A is slightly closer to the center, so more people in the center support A over C in the runoff.

First round is the same as plurality:

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Votes [%]"}],"data":[{"format":{"parse":{"y":"number","x":"string"},"type":"json"},"name":"chart","values":[{"y":34.37,"series":"y","x":"A"},{"y":28.7,"series":"y","x":"B"},{"y":36.93,"series":"y","x":"C"}]}],"width":200}</graph>


Second round after B is eliminated:

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Votes [%]"}],"data":[{"format":{"parse":{"y":"number","x":"string"},"type":"json"},"name":"chart","values":[{"y":53.97,"series":"y","x":"A"},{"y":0,"series":"y","x":"B"},{"y":46.03,"series":"y","x":"C"}]}],"width":200}</graph> Contingent vote behaves the same way, except the runoff election is held automatically based on ranked ballots.

Score

B wins under Score Voting (with normalized ballots), as they are the highest-rated overall by the voters. (Dark-colored voters gave that candidate a maximum score, white-colored voters gave them a minimum score.)

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Total score"}],"data":[{"format":{"parse":{"y":"number","x":"string"},"type":"json"},"name":"chart","values":[{"y":1391.735,"series":"y","x":"A"},{"y":2206.151,"series":"y","x":"B"},{"y":1251.829,"series":"y","x":"C"}]}],"width":200}</graph>

Condorcet

B also wins under Condorcet methods, as B would beat both A and C in head-to-head elections.

A vs B:

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Votes","format":"d"}],"data":[{"format":{"parse":{"y":"integer","x":"string"},"type":"json"},"name":"chart","values":[{"y":1031,"series":"y","x":"A"},{"y":1969,"series":"y","x":"B"},{"y":0,"series":"y","x":"C"}]}],"width":200}</graph>


B vs C:

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Votes","format":"d"}],"data":[{"format":{"parse":{"y":"integer","x":"string"},"type":"json"},"name":"chart","values":[{"y":0,"series":"y","x":"A"},{"y":1892,"series":"y","x":"B"},{"y":1108,"series":"y","x":"C"}]}],"width":200}</graph>

STAR

B also wins under STAR Voting. The first round is the same as Score, so the top-two winners are A and B (since A is slightly closer to the center than C):

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Total score"}],"data":[{"format":{"parse":{"y":"number","x":"string"},"type":"json"},"name":"chart","values":[{"y":1391.735,"series":"y","x":"A"},{"y":2206.151,"series":"y","x":"B"},{"y":1251.829,"series":"y","x":"C"}]}],"width":200}</graph>

B is then preferred over A by a 66% majority.

<graph>{"legends":[],"scales":[{"type":"ordinal","name":"x","zero":false,"domain":{"data":"chart","field":"x"},"padding":0.2,"range":"width","nice":true},{"type":"linear","name":"y","domain":{"data":"chart","field":"y"},"zero":true,"range":"height","nice":true},{"domain":{"data":"chart","field":"series"},"type":"ordinal","name":"color","range":["#1f77b4","#ff7f0e","#2ca02c"]}],"version":2,"marks":[{"type":"rect","properties":{"hover":{"fill":{"value":"red"}},"update":{"fill":{"scale":"color","field":"series"}},"enter":{"y":{"scale":"y","field":"y"},"x":{"scale":"x","field":"x"},"y2":{"scale":"y","value":0},"width":{"scale":"x","offset":-1,"band":true},"fill":{"scale":"color","field":"series"}}},"from":{"data":"chart"}}],"height":150,"axes":[{"scale":"x","type":"x","title":"Candidates"},{"scale":"y","type":"y","title":"Votes","format":"d"}],"data":[{"format":{"parse":{"y":"integer","x":"string"},"type":"json"},"name":"chart","values":[{"y":1031,"series":"y","x":"A"},{"y":1969,"series":"y","x":"B"},{"y":0,"series":"y","x":"C"}]}],"width":200}</graph>