Skip to content

juliusd01/Bayesian_Forecasting_Model

Repository files navigation

Election Forecast for Bundestagswahl 2025 using Bayesian Statistics

Main results for the national forecast:

Vote Share Forecast Vote Share Forecast Vote Share Forecast

Forecasts for each of the 16 states can be found in the results folder.

Package overview

📦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

Replicate results

Setup Environment

  1. Clone or download this repository

  2. Navigate to the project directory:

    cd /path/to/Bayesian_Forecasting_Model
  3. Create the conda environment from the environment.yml file:

    conda env create -f environment.yml
  4. Activate the environment:

    conda activate bayesian-forecast

Run the Analysis

Execute the main scripts to generate results:

python 2step.py             
python 5poll_model.py 
python plot_voter_preferences.py

Results will be saved in the results/ folder.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published