https://github.com/corymccartan/us-house-old
Statistical modelling of U.S. House elections.
https://github.com/corymccartan/us-house-old
Last synced: 4 months ago
JSON representation
Statistical modelling of U.S. House elections.
- Host: GitHub
- URL: https://github.com/corymccartan/us-house-old
- Owner: CoryMcCartan
- Archived: true
- Created: 2017-06-20T07:40:04.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-17T16:22:39.000Z (over 7 years ago)
- Last Synced: 2025-01-10T23:35:04.892Z (5 months ago)
- Language: Jupyter Notebook
- Homepage:
- Size: 4.83 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# U.S. House Election Prediction
This is a statistical model for the biannual elections of the United States House of Representatives. We use a Bayesian model based on informative priors and generic congressional ballot polling. The model is implemented in [Stan](http://mc-stan.org) and coded in Python.## Files
- `house.ipynb` is a Jupyter notebook that lays out the model and walks through the data collection, processing, and modelling.
- `house.stan` is the Stan model
- `house.py` loads prior models, prepares data for analysis, runs the simulation, and outputs the results.
- `priors.py` collects data and fits prior models.
- `models/` contains the fitted models in Pickle format. These are stored to save time later and can be renerated at any time.
- `data/` contains data needed to fit prior models and run the analysis—polling, historical results, etc.
- `site/` contains the website that displays the analysis and model results.## Reproducing the Analysis
1. Clone the repository, or [download it](https://github.com/CoryMcCartan/us-house/archive/master.zip).
1. Install required packages:
```
pip3 install -r requirements.txt
npm i -g rollup uglifyjs npm-sass
npm i
```
1. Run `./house.py`
1. To view the analysis website, build it and serve the `docs/` folder:
```
cd site/
npm run build
cd ../docs/
python3 -m http.server
```