Main results for the national forecast:
Forecasts for each of the 16 states can be found in the results folder.
📦Term_paper
┣ 📂Resources_all # Data sources used
┣ 📂results # The folder where all results are saved when running the scripts
┣ 📜2step.py # Script to generate main results
┣ 📜2step_model.ipynb # Notebook where it's easier to follow single steps, includes additional plots
┣ 📜5poll_model.ipynb # Notebook for running the 5 poll model once
┣ 📜5poll_model.py # Script to generate graphical and numerical results for the 5 poll model
┣ 📜README.md
┣ 📜beta_sensitivity.py # Testing sensitivity of beta in the Gamma distribution in nations prior
┣ 📜c_sensitivity.py # Testing the scaling factor in the Dirichlet distribution
┣ 📜create_legend_for_parties.py
┣ 📜environment.yml
┣ 📜license
┣ 📜plot_voter_preferences.py # Script to generate Figure 11
┗ 📜requirements.txt-
Clone or download this repository
-
Navigate to the project directory:
cd /path/to/Bayesian_Forecasting_Model -
Create the conda environment from the
environment.ymlfile:conda env create -f environment.yml
-
Activate the environment:
conda activate bayesian-forecast
Execute the main scripts to generate results:
python 2step.py
python 5poll_model.py
python plot_voter_preferences.pyResults will be saved in the results/ folder.


