This repository contains the code for running a dynamic and hierarchical Bayesian model that forecasts election outcomes in states, the nation, and the electoral college. The model is written in Stan and the supporting pipeline is written in R.
The model improves upon the Economist’s 2020
model (which, in turn,
improved upon Pierre Kemp’s
implementation
of Drew Linzer’s
model)
by estimating the parameters used to generate state covariance matrices,
rather than being passed the matrices as data. I intend to write a
formal explanation of the model, likely after the election has
concluded. In the interim, you can view a brief overview of the model
definition in the README in the stan/
folder.
A more general overview of the model methodology can be found here, and the full output can be explored here.
- Added a model review/diagnostic display under
out/REVIEW.md
- Added conditional probability plot functions for the National page.
- Modified the prior/polling stan models and supporting R pipelines to
support Kamala Harris as the democratic candidate. More details can be
found in the
stan/
directory README. - Updated site functions’ internal variable naming and public facing candidate names to refer to Kamala Harris.
- Updated time-series plots on site to only display projections from 8/1 onwards.
- Updated function documentation and READMEs based on new output.
- Fully re-ran the entire model from 5/1 onwards. An archived version of
the final run with Biden as the democratic candidate can be found in
the
archive-biden
branch in this repository.
- Corrected the need to run the polling model with the
prior_check
flag for run dates before 5/7. (#10) render_interactive_map()
now correctly renders the ggobj passed as an argument, rather than looking for a specific object in the global environment.- Fixed a small bug causing the prior stan model to underestimate uncertainty in the combination of the estimated national voteshare and state partisan lean.
- Added conditional probability as a poll model output.
- The output is not yet made available in the UI, but will be as a result of a later release.
- Modified header text to include the article “the” on D.C.’s state page.
- Initial release
- FiveThirtyEight
- The Economist
- JHKForecasts
- DDHQ
- Silver Bulletin (requires subscription to view output)