Politics, elections and piffle plinking

Federal Election Simulation!

As some of you may remember, during the US election we ran big monte carlo simulations using Intrade data to try and forecast the result of the Electoral College vote – it was pretty successful all up, predicting 364 EVs when the actual result was 365. But we’ll get into just how it all went when the yanks can finally finish their election count in the Senate races.

So I thought we’d develop a similar monte carlo simulation for our own political horserace, but instead of using Intrade or other betting data, we’ll use the polls.

Today we’ll just go over a draft model of the simulation. I’ll change it over the coming months to reflect things like polling margin of error, and perhaps some demographics as well, maybe even some flash widgets and spiffy toys to go along with it – but for now we’ll just go through a basic version to show how it all works.

Simulations are much easier than they sound – so fear not aspiring nerds! We simply take the information we know (the previous election results and the fact that in Australia we have a uniform swing of X with a standard deviation of Y) and compare it to the information we think we know (the polling data) to answer the question “Using all of this information, what is the probability of a party gaining a given number of seats if an election were held today?”

First up, the information we do know.

In Australia at each election, because of our two party system we generally experience a uniform swing toward or against the government of some given percent, and a standard deviation of some given number. If we break down previous election results by State, we get the same thing – and the standard deviations (which become important for monte carlo sims) are strangely consistent.

If we look at the average TPP swing in each State at the last 3 Federal Elections, and where we throw all the Territory and Tasmanian seats (which aren’t generally polled often, if at all) as a group lumped under “Other”, we get:

Average Swing
2001 2004 2007
NSW 3.3 0.3 -5.6
VIC 1.4 3.2 -5.1
QLD 1.9 2.2 -7.6
SA 0.8 0.3 -6.7
WA 1.2 3.8 -2.1
Other -0.3 1.9 -2.3

We can also look at the standard deviation of those swings by State and calculate their average over the last 3 elections.

Standard Deviation
2001 2004 2007 Average
NSW 2.5 2.6 2.6 2.6
VIC 2.0 2.2 2.3 2.2
QLD 2.5 2.5 3.2 2.7
SA 1.6 2.3 2.3 2.1
WA 1.3 2.1 1.9 1.8
Other 1.9 3.0 2.3 2.4

So this let’s us know, for example, that NSW in 2007 had a uniform swing of 5.6% toward the ALP with a standard deviation among all the seats in NSW of 2.6%.

You might also notice the way that each State has a remarkably consistent standard deviation of their swing over time.

We also know the two party preferred results of the last election for every seat, which will become our baseline for calculating our swing probabilities.

Moving on to the things that we think we know – the thing we’ll need to calculate how far public opinion has shifted – well that’s where the polls come in. We have good Federal polling data broken down into states from not only the Newspoll quarterly demographic release, but also from Nielsen polls. Eventually I’ll combine both the Nielsen and Newspoll data for this, but for now we’ll just use the Newspoll Quarterly.

To run the simulation, what we do is first group all 150 seats by State – let’s use the example of NSW for this. We know from the last quarterly Newspoll that currently NSW has an average swing towards Labor of 3.2% on the two party preferred. We also know that historically, the standard deviation for any given swing in NSW is 2.6%

So we create a normal (bell shaped) probability distribution for every seat in NSW (let’s use the seat of Macarthur here as an example) that has a mean of 3.2 and a standard deviation of 2.6. We then draw a random number from this probability distribution to give us 1 iteration of the probabilistic swing that Macarthur would be expected to experience if an election were held today – let’s say that number drawn was 2.8 – slightly less than the mean of 3.2 that Newspoll is currently telling us NSW is experiencing. We then take the TPP result from the last election for Macarthur of 49.3% and add to it the random number drawn from the probability distribution of 2.8. This gives us a simulated number of 52.1. We then call this seat by saying that if the simulated TPP number is greater than 50 then the seat goes to the ALP, if it is less than 50 it doesn’t.

We then do that for every single seat across the country and sum up the numbers of called seats and that is our first iteration. We might get 102 simulated seats won by the ALP for that iteration. We then do that another 10,000 times and take all those results and turn it into a probability distribution. From that, we can calculate the probability from current polling results that the ALP would get any number of seats were an election held today and the polling results are an accurate reflection of public political opinion.

A few things worth nothing though. Firstly I have assumed that all three independents will win their seats at the next election and that Lindsay Tanner’s seat of Melbourne will again become a Two Party Preferred contest between the Coalition and Labor (rather than Labor and the Greens which it was at the last election). Secondly, with the Territory and Tassie seats being grouped together, I’m using the national swing as their swing, but am using the average standard deviation of the last 3 elections derived from those “Other” seats.

This is what the results look like:

The first chart, the histogram, shows us the raw results of the simulation when calculated in terms of the number of seats that would be expected to change hands. The last two charts show us the probability that the ALP would gain a given number of seats based on the current polling.

Just pick a number of seats from the bottom, trace it up until it intersects the red line, then trace across to the left axis -that will tell you the probability of that number of seats being gained by the ALP (or the ALP having that number of seats in a new Parliament).

For instance, there’s a 42.6% probability of the ALP gaining 20 seats based on the polling from the last quarterly Newspoll.

I haven’t yet adjusted properly for State and seat non-independence – which I will in the near future, and we’ll also adjust for polling margin of error issues. The histogram should get a little flatter as a result, but I thought you might be interested in the results thusfar.

7 Comments

  1. 1
    Andos
    Posted November 26, 2008 at 11:51 am | Permalink

    Excellent work yet again, Scott.

    I await the evolution and refinement of this latest tool with excitement and anticipation.

    Oh, as a personal contribution, I’ll be working hard to make sure we don’t see another ALP/Greens TPP contest in Melbourne next time… just to make your model more accurate, see?

  2. 2
    David Richards
    Posted November 26, 2008 at 3:51 pm | Permalink

    so – virtually dead cert +9 to +13 for the ALP with up to 96 seats. Should put an end to talk of the Libs getting back in anytime soon. Poor Mal.

  3. 3
    Posted November 26, 2008 at 3:58 pm | Permalink

    Thanks Andos!

    At the moment DR, that looks to be the case.

  4. 4
    Posted November 27, 2008 at 10:36 am | Permalink

    You are a god.

  5. 5
    Posted November 27, 2008 at 12:41 pm | Permalink

    Well AV, if you know of another one, could you get them to drop me a line and let me know which page in the manual is about stopping the rain?

  6. 6
    Cuppa
    Posted November 27, 2008 at 3:19 pm | Permalink

    ‘Polls for Dummies’ (well this Dummy anyway). Thanks for the lucid explanations of complex concepts – and for the heartwarming prediction. :D

  7. 7
    Posted November 27, 2008 at 7:31 pm | Permalink

    We need more rain Possum, not less. They tell me they have deliberately left the page about rain out of your manual. They don’t trust Aussies when it comes to water management.

Post a Comment

You must be logged in to post a comment.