Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The election forecasts
Building on my recent blog posts, I’ve put up a page dedicated to forecasts of the coming Australian federal election. It takes the state space model of two-party-preferred vote from my first blog on polls leading up to this election, and combines it with a more nuanced understanding of the seats actually up for grabs in this election than I’d been able to develop for my second blog, on swings. For the current margins at divisional level after the various electoral distributions, I’m drawing on this excellent summary by the ABC.
To cut to the chase, here’s my prediction – 76 percent chance of ALP being able to form government by themselves:
Because the forecast is built on division-level simulations of what will happen when local randomness adds to an uncertain prediction of two-party-preferred swing, I also get probabilistic forecasts for each individual seat. This lets me produce charts like this one:
…which shows what is likely to happen seat by seat when we get the actual election.
The ozfedelect
R package
The ozfedelect
R package continues to grow. Just today, I’ve added to it:
- a vector of colours for the Australian political parties involved in my forecasting
- a useful data frame
oz_pendulum_2019
of the margins of the various House of Representatives seats going in to the 2019 election. - update of polling data.
All this is in addition to the historical polling and division-level election results it already contains.
Code for these forecasts
The code for conducting the forecasts or just installing ozfedelect
for other purposes is available in GitHub. The ozfedelect
GitHub repository not only will build the ozfedelect
R package from scratch (ie downloading polling data from Wikipedia and election results from the Australian Electoral Commission) it also has the R and Stan code for fitting the model of two-party-preferred vote and turning it into division-level simulated results.
It should be regarded as a work in progress. Comments and suggestions are warmly welcomed!
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.