This site summarises the NZ Herald Poll of Polls for the 2023 election. The source code is on GitHub.

The Poll of Polls is a Bayesian state space model primarily based on a model developed by Peter Ellis for the 2017 and 2020 New Zealand elections.

Articles

Articles that have been published based on the Poll of Polls include:

These articles are behind the Herald’s premium paywall. This site and all the source code associated with the model have been released under a GPL3 license

Quick start

More details are available on the setup page. You will need to have a working R environment.

# install.packages('renv') # if you don't already have renv
renv::restore()
cmdstanr::install_cmdstan()
targets::tar_make()

Running the model will take 15 or so minutes. Once it is complete you can load the model summary object with

targets::tar_load(model2023_summary_model2023)

Overview

This model is largely a reproduction of Peter Ellis’ model for 2017/2020. Peter has written about the development of the model here, here, here, and here.

Peter’s model is based on an approach outlined in a 2005 paper by Simon Jackman: Pooling the Polls Over and Election Campaign - currently a copy is available here

The approach assumes that at any given time there is a latent voting intention that is imperfectly and irregularly measured by polls and well measured once every three years during an election.

This model works exactly the same as Peter’s model with three modifications:

One of the less satisfying aspects of this modelling approach is that voting intention evolves over time as a random walk. While this is unlikely to be true it works well enough. But it would be good to be able to constrain the way voting intention evolves in a politically sensible manner. Peter was able to do this in 2020 by looking at historical swings away and towards the government. With the recent change in Prime Minister we decided this approach wasn’t applicable. However, we are open to suggestions :)

Similar work

Bayesian state space models have, and are, used to model and forecast the Swedish and German parliamentary elections.

Feedback and improvements

If you have any (non-politicised) feedback and suggestions of how the model could be improved please create an issue or email Chris Knox.

Acknowledgements

We are enormously grateful to Peter Ellis for both developing his model and making it available for use.

None of this would be possible without the R and Stan programming languages and their communities of open source developers.

License

All source code in this repository is available under a GPL3 license

Portions of the source code are very heavily based on Peter’s original code which was also released under a GPL3 license.