Wed, 20 Apr 2011

Alternative Vote Ice Cream

This all started when a friend asked me "how do you count AV ballots?". I tried to give a demonstration by picking some random numbers for number of votes cast, but, ultimately, it wasn't a very good explanation. So the idea formed, why don't I get some real data, and then I can talk through counting, with all the transfers and other detailed bits of AV.

So I put together a small google form asking for people to give a preference on their favourite flavour of icecream. People filling it in could fill in from 1 to 5 preferences, for their flavour of icecream from the 5 choices given: Chocolate, Mint, Vanilla, Strawberry, Fudge. The flavours I chose were picked at random and were just to give us some names to work with, I could easily have chosen A, B, C, D, E, the data would still serve its purpose.

What I hadn't expected when I released the survey unto the net that I would not only get some lovely data to work from, but also, some nice realistic spoilt ballots (due to a bug in google forms). Cheeseburger, Potato, Coffee and "CabooseRules" were all imaginative responses, but were alas, spoilt ballots, just like in the real thing. I left the survey running having tweeted about it and distributed the link to various IRC channels, and in the end I had 71 responses.

With these 71 responses in hand I set about counting them by hand, to which I got the response "You're counting manually?". Well, as a student I took part in the count of many Student Union Elections using a very similiar system (Single member STV), and so I am very comfy counting by hand. My friends however are mostly geeks and like a challenge, so between them they decided to see if they could write some software to count the votes, resulting in 3 implementations in Python, and one in Haskell.

So what are the results?

Round 1 Round 2 Transfer Round 2 Total Round 3 Transfer Round 3 Total Round 4 Transfer Round 4 Total
Vanilla15 +3 18 +4 22 +11 33
Mint22 +1 23 +3 26 +6 32
Chocolate13 +2 15 +3 18 - -
Fudge9 +1 10 - - - -
Strawberry7 - - - - - -
No further Preference0 0 0 0 0 1 1
Total66 - 66 - 66 - 66
Quota33 - 33 - 33 - 33

If we were running the election as first past the post, Mint wins, with 22 votes. But, 44 voters did not want Mint. It is worth noting however that if this was run a FPTP the result may be slightly different as people may vote tactically. Now, as you follow across the rounds of counting and the transfers you can see as first Strawberry, then Fudge, then Chocolate are eliminated, until only Mint and Vanilla are left. With 32 votes to Mint, and Vanilla on 33. Vanilla thus wins.

Now the no2av crowd will no doubt leap on this as "how did Vanilla win? it came second" The point here is we have not elected the most popular, but the least unpopular. How many people if given an icecream would grumble if given Mint? but would be quite happy to receive Vanilla? And that is the big advantage of AV. Gone are the days where a very small minority of the electorate can dictate to the rest. You need the support of 50% of those voting to win. Something Vanilla acheives in this example.

What is also crucially demonstrated in all of this however, is that people are not getting more than one vote. If you look at the total in each round, it stays constant across the count. Each ballot is counted at most once per round, not being counted if no further preference is made. Pretty simple really?

The google spreadsheet with all the results in it can be found here or if you prefer as a CSV file here, so you can have a go at counting yourself, work it out, follow the process through, and understand it. In the spreadsheet I have coloured eliminated votes, and marked the vote that counts in bold. There is also a second sheet (marked "Working") which shows the totals I got from my hand count, plus the same as percentages.

For the more geeky amoungst us there is a Haskell, Python & Python & another Python implementation of the count by Tom Davie, Andee Cassidy, Shish, and Steve Engledow respectively.

So hopefully this little exercise will demonstrate a bit better how AV internals work. But, do remember, you don't need to understand the above to vote AV, as a voter all you need to do is rank as many of the candidates as you like in order of preference, as simple as 1, 2, 3.

posted at: 16:44 | path: / | permanent link to this entry | 0 comments


Name:


E-mail:


URL:


Comment: