## Voting system simulation

For the serious discussion of weighty matters and worldly issues. No off-topic posts allowed.

Moderators: Azrael, Moderators General, Prelates

Qaanol
The Cheshirest Catamount
Posts: 3069
Joined: Sat May 09, 2009 11:55 pm UTC

### Voting system simulation

Hi everyone!

If you’re like me, then you fondly remember the grand debates about voting systems we used to have here, and the voluminous accompanying discussions about what qualities are important in a election method and how to compare them.

If you actually are me, then you’ve spent significant time thinking about this subject over the last few years, and two months ago you starting coding up a voting simulation program to run thousands of virtual elections in order to get quantitative results about how different voting systems perform. And today you finally got it running. Debugged and everything too!

So! Before I get too deep into running simulations and generating results, lets talk about how it works, what makes sense, and how I can improve it. Here’s what the user interface looks like:
Spoiler:

The basic idea is to simulate a slate of candidates and a population of voters, run them through each voting system, tally the results, and repeat with a new batch of voters and candidates a whole bunch of times. Then summarize the overall trends.

The summary statistics are pretty straightforward:
• Average utility of the winning candidates for each system
• Average Bayesian regret of each voting system (ie. highest utility among candidates minus utility of winner)
• How many times the candidate with highest utility wins under each voting system

The calculation of utility is a little involved, but should make sense:
Spoiler:
Each voter and each candidate has a position on each of n “issues”, and those positions are drawn from a standard normal distribution. Each voter also has an “importance” or weight for each issue, indicating how important that issue is to them, drawn from a standard exponential distribution.

Each voter calculates the sum-of-squares weighted distance to each candidate, as s = ∑(wi × (vi - ci))2, where the w’s are the voter’s weights, the v’s are the voter’s positions, and the c’s are the candidate’s positions, and the sum is taken over all n issues.

Then there are two options, selectable by the “Utility” popup in the program. If “Exp” is chosen, then the calculation is u = exp(-s / 2n) and if “RMS” is chosen, then the calculation is u = -√(s / n), where in both cases n is the number of issues.

So that is how voters calculate their true honest utility for each candidate, and those are the values which, when averaged over all voters for a given candidate, are used to compare the quality of winners of different voting systems.

Now, when the simulator is run, it loops through all numbers of candidates and issues in the ranges specified by the user, and carries out the full complement of elections for each voting system with those values. To explain how that works, first I need to describe the “Voter Behaviors” table:
Spoiler:
Each voter has a strategy, either “Standard” or “Minmax”, and a level from 0-4. The proportion column just indicates the relative frequency of each type of voter in the population. The strategies are a little involved, so I’ll hold off on explaining those until later, though I will mention that this is one area where I am very interested in feedback, especially regarding what mixes of voter behaviors to use.

The “Level” values are much simpler to explain: when a voter looks at a pre-election poll, they take each candidate’s vote total, and raise it to the k’th power, where k is the voter’s level, and they treat those values as the candidates’ relative odds of winning. (Technically, the results are scaled at each step so they sum to 1 across all candidate, but the effect is the same.)

So a level-0 voter ignores the polls and treats each candidate as equally likely to win. A level-1 voter treats the percentage of votes that a candidate received in a poll, as that candidate’s odds of winning. And higher-level voters assign progressively higher likelihoods of winning to candidates near the top of the polls, and lower likelihoods to candidates near the bottom.

For example, if the poll results are 40%, 30%, 20%, 10%, then a level-3 voter will consider the candidates to have, respectively, 64%, 27%, 8%, and 1% odds of winning. Voters use their perceived probabilities for each candidate to win, in conjunction with their honest utility values for each candidate, to determine how they will vote in each election.

With all that explained, the elections themselves can be described:

Spoiler:
The voter and candidate positions and weights are generated at random, and the honest utility values are calculated as above. Then each voting system runs a series of polls, as many times as the user specified for “Polls” and with as many voters as they specified for “Poll voters”. The poll voters are chosen uniformly at random, and the same voters are used for a given poll across all voting system.

Polls are just miniature elections. For the first poll, the “Electability” popup determines how likely the voters think each candidate is to win. If it is set to “Equal” then voters initially think all candidates have the same chances. If it is “Random” then each candidate is given a “Charisma” score drawn from a standard exponential distribution, and voters apply their strategy-level calculations to it. And if electability is set to “Ignore polls” then the voting system skips all the polls and goes straight to the election, using “Equal” electability so the result is that all voters act honestly (ie. as if they had strategy level 0).

In any case, the first poll is tallied by each voting system, and those results are fed into the next poll for voters to use in calculating their perceived odds for each candidate to win. This continues until all the polls are finished. Note that since the tallies are almost certain to differ between voting systems, that the voters are apt to behave differently in subsequent polls.

When all the polls are done, the results of the last one is used as input for the full election where all voters cast a ballot. And the results of that election show which candidate won under each voting system.

One thing I haven’t mentioned yet is the “Options” column. That just tells a voting system how many spots there are on the ballot for a voter to mark. The value 0 means to use the default for that system. With ranked methods like IRV and Schulze, specifying an options value means that voters indicate their “top x” choices (using their own strategy to determine who those top x are). With rated methods like Score and Majority Judgment, the options value tells how many different ratings are available.

I think that just about covers everything, and this post ended up way longer than I envisioned. So please let me know what you think, if you have questions or ideas, and whether you care to find out how the voter strategies work!
wee free kings

slinches
Slinches get Stinches
Posts: 1036
Joined: Tue Mar 26, 2013 4:23 am UTC

### Re: Voting system simulation

Neat. Will the source be available anywhere? I'd be interested in playing around with it. It sounds like an ideal way to check out the relative sensitivities of the various voting systems to changes in voter demographics. (In other words, find out how terrible FPTP really is)

Qaanol
The Cheshirest Catamount
Posts: 3069
Joined: Sat May 09, 2009 11:55 pm UTC

### Re: Voting system simulation

Thanks! I’m not sure about releasing the source, but we’ll see.

I’m already noticing some interesting dynamics in voting system behaviors, but I don’t want to get too caught up in these early results. So far all my large-scale simulations have been with the voter behaviors shown in the screenshot above, namely all standard strategy voters with an equal mix of levels.

What I’m seeing is that when there is exactly 1 issue, things turn quite a bit different from when there are multiple issues. Also, the effect of honest versus strategic voters is not always straightforward.

Some voting systems do a little bit *better* when there are strategic voters, some do a little bit worse, and a few do a *lot* worse. And for a handful, it depends on how many candidates and how many issues there are.

But by and large, plurality voting is pretty consistently one of the worst no matter what the settings. That said, there are specific configurations that can make certain other voting systems behave even worse than plurality.
wee free kings

Zamfir
I built a novelty castle, the irony was lost on some.
Posts: 7604
Joined: Wed Aug 27, 2008 2:43 pm UTC
Location: Nederland

### Re: Voting system simulation

What kind of elections do you want to model? Perhaps I am missing something, but it it looks to me like you're modelling a presidential election for a country where presidents have largely unchecked law-making capacity. A single candidate wins, and that candidate's positions become policy.

I guess we're from different countries. Over here, no election at all elects one candidate. Every election is for members of a body, using proportional representation and party lists. This must be one of the most common voting systems worldwide, if it's not the single most used system.

Even in countries without a PR system, many elections are still for members of a body, like the US congress. In such cases, you can't calculate a regret function directly from the candidate elected, you'd have to account for post-election dynamics inside the elected body. For example, the US has a two-party system because of those congress-wide dynamics, not just because of effects at the level of a single member's election.

Don't take this the wrong way, it looks like an interesting exercise. But from my POV, it's a strange exercise. Like someone builds a tool to help select the best car, and the tool looks at every pickup truck on the market.

Qaanol
The Cheshirest Catamount
Posts: 3069
Joined: Sat May 09, 2009 11:55 pm UTC

### Re: Voting system simulation

Zamfir wrote:What kind of elections do you want to model? Perhaps I am missing something, but it it looks to me like you're modelling a presidential election for a country where presidents have largely unchecked law-making capacity. A single candidate wins, and that candidate's positions become policy.

I guess we're from different countries. Over here, no election at all elects one candidate. Every election is for members of a body, using proportional representation and party lists. This must be one of the most common voting systems worldwide, if it's not the single most used system.

Even in countries without a PR system, many elections are still for members of a body, like the US congress. In such cases, you can't calculate a regret function directly from the candidate elected, you'd have to account for post-election dynamics inside the elected body. For example, the US has a two-party system because of those congress-wide dynamics, not just because of effects at the level of a single member's election.

Don't take this the wrong way, it looks like an interesting exercise. But from my POV, it's a strange exercise. Like someone builds a tool to help select the best car, and the tool looks at every pickup truck on the market.

Multi-winner elections, including proportional representation, are high on my list of things I’d like to add to this program. I don’t know how long it’ll take though.

I’m not claiming my model is perfect or anything, far from it. However, in the USA every election is single-winner at the moment, and a lot of the high-profile ones are for executive positions: President, Governor, Mayor, etc. Not to mention, some parts of the country have elected judges.

But even for legislative elections, in the USA they’re single-winner at every level, and although you are correct that intracameral dynamics are important, the fact remains that having your representative agree with your views provides a lot more utility to you than the alternative.

So, while there is definitely room for improvement, I think the approach I’ve taken is useful at least for preliminary analysis of voting systems in single-winner elections.
wee free kings

Autolykos
Posts: 97
Joined: Wed Jun 25, 2014 8:32 am UTC

### Re: Voting system simulation

Looks like a really cool project. I second the demand for the source; I'd love to play around with it a little.

On election strategies, you might want to figure in that politicians tend to be dishonest, and are often seen as dishonest (e.g. they are likely to misrepresent their more unpopular opinions, if they are not central to their agenda - and are expected to do so). This requires voters to adapt their strategies (e.g. weigh the statements made by how unpopular they are). Or, in game theory terms, ignore cheap talk and look for costly signaling.
It may also be enlightening (but possibly depressing) to find out what degree of dishonesty is optimal for getting elected.

Reko
Posts: 13
Joined: Thu Sep 11, 2014 8:43 pm UTC

### Re: Voting system simulation

This is probably going to be a stupid point/question, but does a one candidate ballot have any effect on the above, um, outcome methods or voting strategies? I figure this is likely irrelevant but I don't know the source code nor do I know this history of these discussions here so I wasn't sure if that mattered or not. Fwiw, I suspect it doesn't matter.

For those curious, this generally occurs on the local level, like district school boards, city municipality boards, etc.

Qaanol
The Cheshirest Catamount
Posts: 3069
Joined: Sat May 09, 2009 11:55 pm UTC

### Re: Voting system simulation

Autolykos wrote:Looks like a really cool project. I second the demand for the source; I'd love to play around with it a little.

On election strategies, you might want to figure in that politicians tend to be dishonest, and are often seen as dishonest (e.g. they are likely to misrepresent their more unpopular opinions, if they are not central to their agenda - and are expected to do so). This requires voters to adapt their strategies (e.g. weigh the statements made by how unpopular they are). Or, in game theory terms, ignore cheap talk and look for costly signaling.
It may also be enlightening (but possibly depressing) to find out what degree of dishonesty is optimal for getting elected.

That is a really intriguing concept. In fact, it gives me an idea for revamping how voters behave, and how utility scores are calculated.

Right now, I am using the same value, essentially the weighted distance between voter and candidate positions, to function both as the voter’s honest opinion, and also as the true utility of the candidate to the voter. However, that need not be the case. Instead, there could be one value representing “How much the voter thinks they will like the candidate, based on the candidate’s charisma and how sharply- or vaguely-defined the candidate’s positions are before the election.” Then there could be another value representing, “How much the voter actually likes the candidate, based on the candidate’s actual positions which will only become known after the election if they are elected.”

In other words, let each voter have:
• A position on each issue
• An importance level for each issue
• A tolerance of disagreement in general

And let each candidate have:
• A position on each issue
• A “nebulosity” on each issue
• An overall level of political skill

I’m still figuring out the details, but essentially each candidate would have a normal distribution centered on their true position, with standard deviation equal to the vagueness (nebulosity) of their position prior to the election, and amplitude equal to their political skill (or charisma). Voters would only know the value of that distribution at the voter’s own position, which represents essentially “How likely is the candidate to agree with me on this issue?” Then voters would weight those values by their own importance level of each issue, and find their perceived value for each candidate prior to the election based on their tolerance for disagreement.

The actual “true” utility values could be calculated pretty much as they are now, from the weighted average distance between voter and candidate positions. In other words, each voter has a normal distribution centered on their position, and the value of that distribution at the true position of each candidate is how much utility the voter actually assigns to that candidate.

Reko wrote:This is probably going to be a stupid point/question, but does a one candidate ballot have any effect on the above, um, outcome methods or voting strategies? I figure this is likely irrelevant but I don't know the source code nor do I know this history of these discussions here so I wasn't sure if that mattered or not. Fwiw, I suspect it doesn't matter.

For those curious, this generally occurs on the local level, like district school boards, city municipality boards, etc.

I am not modeling write-in candidates, so a single-candidate election is degenerate. If someone is running unopposed, they will win. I suppose I could introduce a way for voters to do write-ins, or even to vote for “Nobody”, but that would be a lot of work for little benefit. Basically, if a candidate isn’t on the ballot, they aren’t a serious contender.

More importantly, I am modeling 2-candidate elections, and I am not treating them as a special case. I am letting each election do its thing. And it happens, as should be expected, that every voting system always elects the same candidate as every other voting system when there are two candidates. Because all voting systems are equivalent to plurality voting in the 2-candidate case. (Well, slight caveat, I ought to say every *reasonable* and *deterministic* voting system is equivalent in the 2-candidate case, because things like “random winner” and “random ballot” are obviously different.)
wee free kings

Qaanol
The Cheshirest Catamount
Posts: 3069
Joined: Sat May 09, 2009 11:55 pm UTC

### Re: Voting system simulation

Okay, I’ve added a couple extra options:

Spoiler:

• The “Spread” setting controls the standard deviation of the population’s positions on issues.
• The “Uncertainty” setting controls the standard deviation on how well candidates’ positions are known to the voters.

Opinions are calculated like this:
Each candidate has an uncertainty affiliated with each of their positions, which means that the graph of “How likely is this candidate to how a given position” is a gaussian. Each voter has a tolerance for disagreement with each of their positions, which means that the graph of “How much does this voter like someone with a given position” is a gaussian. The product of those two gaussians, integrated over the entire issue-space, is the voter’s expected utility for the candidate.

The voter uses that expected utility as their honest opinion of the candidate, and bases their (possibly strategic) ballot on those opinions. However the actual utility of the candidate to each voter is given by the voter’s true utility function (gaussian) evaluated at the candidate’s true position. The point being, that voters do not actually know precisely where a candidate stands before the election.

Of course, this might simply be a lot of noise that takes away from directly comparing voting systems, so when “Uncertainty” is set to 0, voters can see each candidate’s true position and thus their honest opinions are the same as their true utilities.
wee free kings