Since we now have an up to date poll for the Qld election, albeit one with a relatively small sample size, we can start to do some monte carlo simulations to work out the probabilities of a given party gaining a given number of seats were that poll to come true on election day. So we better put out a Nerd Alert here less people start getting scrappy with me because their head exploded
But before we do that, I better give a quick run down on how it all works. Running a simulation is a two step process – first we have to build a simulation for any election result, then we can simulate a poll as if it were an election, since using polling data adds an extra layer of uncertainty that must be dealt with – the dreaded margin of error (or more precisely, the standard error of the poll).
We have to do these things from the perspective of a single party – so we’ll take the government, the ALP.
What we do is list the two party preferred margins of every seat in Qld as if they were a pendulum. Here I’m using Antony Green’s pendulum numbers. Then we make two numbers – one called X which is the swing we want to simulate, and another called Y which is the standard deviation of that swing. The standard deviation is a measure of the seat to seat variation we should expect with a given uniform swing – in Federal elections the standard deviation of a uniform swing is generally between 2 and a half and 3 and a bit.
Next up we generate a set of random numbers from a normal probability distribution, one for each electorate, where each distribution has a mean (or average) of X and a standard deviation of Y. For the not so nerdy types, that is simply a bell curve where the highest point on the curve has a value of X and where 95% of the numbers we generate under that bell curve fit within 2 standard deviations (or 2Y) of the mean.
So what we’ve done is generate 89 swings with a mean of X and a standard deviation of Y. If the randomly generated swing for each seat is large enough so that the seat would fall to the LNP we give that seat to the LNP. If the swing is small enough so that the seat is retained by the ALP, we give that seat to the ALP.
We then add up all the seats that the ALP would have won in this single simulation and make a record of it.
We then repeat the process 200,000 times and we get 200,000 simulated election results. That allows us to create probability distributions out of those simulated election results that can tell us the probability of the ALP winning any given number of seats with any given sized swing.
So let us say, hypothetically, that the LNP receive a swing of 6% towards them on election day – which would be a two party preferred of 51/49 to the Liberal National Party. And let us also say that the standard deviation of the swing is 4% ( The standard deviations of QLD State elections have been a bit all over the place lately with One Nation making things difficult on the one hand, and Qld often experiencing quite a wide variation compared to other states in terms of geography on the other). A standard deviation of 4% is a realistic number and would mean, for instance, that 95% of all Qld seats would actually end up swinging between a 2% swing to the ALP and a 14% swing to the LNP with an average swing of 6% to the LNP.
When we run our simulation, this is what such a result would probabilistically look like.
Election Simulation – 6% Swing to LNP with Standard Dev. of 4%
Marked on the charts is the probability of the Labor Party gaining between 45 and 89 seats in Parliament – effectively the probability of forming government. So even if the LNP won the two party preferred vote 51 to 49, the ALP still has a 66.5% probability of retaining government simply because of the size and nature of the margins the currently held ALP seats sit on. The chart with the bars shows you how many times out of the 200,000 simulations each seat number was achieved by the ALP, the second chart let’s you pick any number of seats the ALP can win from the bottom, trace it up until that number intersects with the red line and trace it across to the left to work out the probability of the ALP getting at least that number of seats.
To give an example of why the standard deviation is important, let’s run the same simulation again, but this time reduce the standard deviation – the variation in the swing – down from 4% to 3%.
Election Simulation – 6% Swing to LNP with Standard Dev. of 3%
You’ll notice that the dispersion of the results tightens up quite considerably, to the point where the probability of the ALP winning at least 45 seats with a two party preferred of 49% has now jumped up to 85%.
That highlights the enormity of the problem facing the LNP in winning government – it not only needs a big swing of over 6%, but it also needs that swing to have a very large seat to seat variation in it to guarentee them the Treasury benches. They cannot rely on a tightly uniform swing, they need a big swing with wil variation.
Since we’ve got our election simulation ready to go, we can now run the poll results with it. The only thing we need to do is account for the swing (2% to the LNP) and the uncertainty in the poll – the margin of error issue – via incorporating the standard error of the poll (which is 1.82% for a sample of 752 people and a 53/47 result to the ALP) into the standard deviation of 4% we are using for our baseline. Basically we expand the size of our 4% standard deviation figure to accomodate this extra polling uncertainty. These are the results.
If the election result ended up as a true representation of this poll – i.e. somewhere within the margin of error of a 53/47 result to the ALP, and taking all of that uncertainty into consideration – Labor would have a 99.9885% probability of gaining at least 45 seats out of a chamber of 89. If you want to know the probability of the Labor Party gaining any number of seats if the actual election result is within the MoE of this poll (where we must take both the upside and the downside of the MoE), simply pick a number of seats from the bottom of the second chart, trace it up until it intersects the red line, then trace across to the left to determine the probability of the ALP gaining at least that many seats.
On another matter – how many seats do the LNP need to win to form government?
The simple answer is they need to win 45 to govern in their own right. They currently sit on a nominal 23 seats, meaning they need to hold their own nominal seats and win an additional 22 seats from Labor to form a government all by themselves.
The problem comes with the 4 Independents in the Parliament. If a swing is big enough would the LNP also knock off some of those independents? The simple answer is we just don’t know. We do know that if the Independents all retain their seats, the LNP would then only need 43 seats to have a plurality in Parliament – being the single party with the most number of seats. Were that to occur, the Independents would virtually have to back the LNP to become government. So if that is the baseline, the LNP only really need to gain an additional 20 seats to win. However, if they made a net gain of only 18 seats (and assuming the Indies win) – that would make the new parliament 41 LNP, 4 Ind an 44 ALP – making a LNP/Independent Coalition theoretically possible.
The real game for the LNP starts at a net gain of 18 seats. With a net gain of 20 they are virtually guarenteed the Treasury benches and with a net gain of 23 they can govern in their own right.








17 Comments
SHE’S BACK! Pauline Hanson to run in Qld state election!
http://www.news.com.au/couriermail/story/0,23739,25100249-952,00.html
In the 1996 federal election, Hanson got the biggest swing to the Coalition in Queensland! In Oxley, it was a 21.44% swing to the Liberal Party in Oxley, on the primary vote alone!
Hanson was disendorsed by the Liberal Party during the 1996 campaign. She actually won Oxley as an Independent.
So I guess we could best describe a LNP victory as “unlikely”.
Out of interest, assuming the 18 threshold is reached, are the independents likely to accept a coalition arrangement? What’s their D-40 so to speak?
Dan, they’re all conservatives. Wellington supported Labor back in 1998 but only because he didn’t think the alternative – a Coalition of Liberals, Nationals, Independents and One Nation – was an idea remotely worthwhile with One Nation involved.
And I sometimes fantasise about what would have happened had Hanson remained on the ticket in ‘96… sort of like those alternate history novels where the nazis won the war/JFK survived/prohibition took hold
Nice post Possum. One question:
Why does a standard deviation of 4% equate to a deviation of 8% from the average swing?
Also, what statistical package do you use?
Hanson appeared on the ballot paper as a Liberal. She was disendorsed after the ballot papers were printed. Her votes are always included in the Liberal tally from the election. She did not appear as a recepient of public funding at the 1996 elect so presumably her money went to the Liberal Party. I’ll check at home this evening and see if this was later reversed.
Oz,
The reason comes back to exactly what a normal probability distribution is. There’s a good graphical explanation over at wiki.
http://en.wikipedia.org/wiki/Normal_distribution
Particularly this image:
http://upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Standard_deviation_diagram.svg/325px-Standard_deviation_diagram.svg.png
With a normal distribution, 95% of all values within the distribution are within 2 standard deviations of the mean.
On the software front I use all sorts of stats programs, depending what I’m doing. For simple monte carlo work I use a Crystal Ball.
Antony – that’s a good question. Every man and his dog would have known Hanson was disendorsed in Oxley. It’s not like she exactly snuck in on the Liberal ticket – if she wasnt disendorsed she probably wouldn’t have won the seat to begin with.
Cheers Possum.
Possum,
Are these Monte Carlo simulations safe to perform in front of innocent children? Will Steve Conroy’s web filter control the proliferation of standard deviations? How many iterations a day are harmful to your health?
I remember Hanson being listed as a Liberal, on the Nine or ABC election night coverage in 1996.
How are you going to progress this simulation as further polling arises, Scott? Just use the latest numbers?
That’s the plan Andos, although if a Galaxy poll comes out, say, just on a handful of Brisbane marginals – I can use that poll for those seats and the latest statewide poll for the rest.
It’s a pretty flexible system.
Possum, I have an interesting question for you. Is there a way to modify the MoE to take into account the length of time the poll was done over. A normal poll is done over a weekend and gives a good indication of voting intentions for a fixed instance in time. In this case the poll was done over a long period, one to two months. This must make a difference in the accuracy of the results.
Steconone,
Margins of Error are a function of the size of the polling sample, so it’s pretty much impossible to modify them with statistical trickery. However, when there are a large number of polls through time, we can do things to estimate the true value of public opinion at a given point by taking into account not only current polls, but previous polls and the age of those polls. The Pollytrend line for instance on the sidebar is a time based locally weighted polynomial regression that uses the age of polling data as a piece of information.
But that requires a large number of polls to do.
The longer the polling period for a given poll, the more uncertainty it will contain – but that uncertainty is temporal uncertainty which we can’t actually measure (even though we know it exists) as opposed to sampling uncertainty (the random noise expected from a poll that we use to calculate the Margin or Error).
Unfortunately we can’t modify a single poll and increase the margin or error as the poll ages for we don’t have the information that let’s us know how that original polling result has changed over time.
Only a new poll could tell us that.
I’d put it a different way Possum, and start by explaining what Margin of Error is and what it isn’t.
Let’s look at a simple example of a box with a certain number marbles in it. If you count all the marbles, in theory there is no margin of error as you have counted the entire population. In fact, if you counted the marbles a thousand times, you might find you don’t get the same result every time, and this would allow you to produce a margin of error on this person’s ability to count marbles. That may sound a very odd thing to measure, but it’s the principle behind how they work out the accuracy of speed guns, weight scales, etc. It’s also in essence what Possum’s doing with his Monte Carlo experiement on the Queensland poll, apply the swing over and over again with a variance on the swing to get a distribution of predicted results from which he can produce a margin of error on the prediction and then a probability estimate.
Say instead of 100 marbles in a bag, we had 100 marbles, some white, some black. The experiment is to get the ratio of black to white marbles. If you count all the marbles, and ignoring counting error, we get an exact population ratio with no margin of error. But if we instead sample the marbles to estimate the ratio, then every test we do comes with a margin of error, calculated by a simple formulas based on the sample size. The more marbles you sample, the smaller the margin of error, but the more effort you have to put into counting.
We are doing the same thing with an opinion poll, trying to work out the ratio of supporters for parties by sampling. In a population the size of Australia and with a good random sampling method, you can do a sample of about 2,000 voters and have a margin of error of around +/-2%.
Opinion polling is not done entirely randomly, as it has a series of fudges put in to weight the sample to match certain demographics of the electorate. Opinion pollsters have to do this sort of fudging to keep the cost down. In theory this weighting ads another factor to the margin of error compared to a real random sample, but as the opinion pollsters haven’t usually got a real random sample, their view is they are not adding to the margin of error in correcting the sample. They are correcting for known bias.
What you can’t correct for is unknown bias. Back to the marbles. If after numerous samples of black and white balls, you actually do a complete count and find your sample ratios are consistently wrong, you have to examine if there was something in your sampling procedure that biased the sample. For instance, perhaps the black balls were heavier and less like to be at the top of the box. If you are able to measure the sampling bias by counting the whole population, you can correct for biased sampling. For instance, on election night, we know small booths are counted more quickly and they are also more likely to vote conservative, so we are able to correct for this known bias in reporting order.
But you can’t get a margin of error for unknown bias. You can’t have a margin of error for an out of date poll, you just know it might be wrong. You can’t have a margin of error for bad question design, for bad interview technique. There are a whole series of things that can be wrong which have got nothing to do with statistics and therefore you can’t have a margin of error for. If you measure the weight of an object a thousand times, you can get a margin of error on its weight for those scales, but if the scales don’t measure correctly, you’ve got a margin of error on a measurement which is wrong in the first place.
As Possum may point out, if you do enough experiments, you might be able to work out margin of error. But in an area like manufacturing, the more experiments you do to test reliability, the higher the cost per unit of production. The low public tolerance of planes falling out of the sky causes aeronautics to include a high cost component for testing. But there’s a whole separate science of quality control there.
Remember the punch card counting machines in Florida at the 2000 US Presidential election had margins of error on their ability to count correctly. However, this was based on the machines being serviced and having their chad boxes cleaned. There was no margin of error on badly maintained machines with full chad boxes, though it’s fairly obvious the counting error would probably have been higher.