Skip to content

jseabold/538model

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5c611cc · May 25, 2016

History

22 Commits
May 24, 2016
May 24, 2016
Oct 22, 2012
Oct 22, 2012
May 24, 2016
May 24, 2016
Oct 22, 2012
Oct 27, 2012
Oct 22, 2012
Oct 27, 2012
Oct 27, 2012
Oct 22, 2012
May 24, 2016
May 25, 2016
Oct 27, 2012

Repository files navigation

This is a Python script that replicates some features of Nate Silver's 538 Election Forecasting Model. It was constructed from reading the methodology posts on the old site and the new one at the New York Times. This is my interpretation of these posts. Any and all errors are, of course, mine. Furthermore, this code should be considered as more of an example of how to conduct data analysis in Python using pandas and statsmodels rather than a "real" model. You can consider it a starting point for doing more complex analyses with Python rather than a real forecasting model. Or better yet, consider a fun way to learn some Python data tricks.

The polling data is up to date as of 10/2/2012. It is all publicly available from Real Clear Politics. For some reason Real Clear Politics stopped allowing directory access to their servers, so if you want to update the polling data, you'll have to update the script to walk the links on their site or do it by hand. This should be trivial, I just don't have the time. Historical polling data was obtained from Electoral Vote.

The pollster reliability/weighting data is also very out of date, and I did not attempt to replicate the calculation of these. I simply used old weights.

Pull requests are welcome. Suggestions and comments on anything from the programming to the modeling are also welcome.

The third-party packages used are

and, of course, IPython is used for the notebooks.

About

538 Election Forecasting Model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages