In this repository you will find code and data related to the resarch project Political Predictors of Polling Errors. The aim of this project is to develop a contextual understanding of polling errors and their triggers. Unlike most previous studies, we take a cross-election comparative perspective and put the theoretical focus on characteristics of the electoral contest which may encourage polling errors.
This repository is structured as follows:
- 
All data files are in the data folder. There is one subfolder for each election type investigated.
 - 
The us_president folder contains code for
- scraping US presidential polls from 2000 to 2016 in the scrape folder
 - adding covariates in the covariates folder
 - a hierarchical bayesian model for analysing us presidential polls in the analysis folder.
 
 - 
The us_senate folder contains code for:
- scraping US senate polls from 1998 to 2020 in the scrape folder
 - analysis of US Senate candidate characteristics cen be found in the candidate_characteristics folder
- cleaning the scraped polls and merging additional covariates in the covariates folder
 - a hierarchical bayesian model for analysing us senate polls in the analysis folder.
 
 - analysis of Trumpists can be found in the trumpists folder
 
 - 
The german_bundestag folder contains code for:
- scraping German Bundestag electiopn polls from 1994 to 2021 in the scrape folder.
 - There are subfolders in the analysis folder for:
- data preparation in the preparation folder,
 - descriptive plots in the desc folder,
 - fitting a hiearchical bayesian model for analysing German Bundestag polls desc folder,
 - visulaizing results in the results_vis folder.
 
 
 - 
The german_landtag folder contains code for:
- scraping German Landtag election polls from 1994 to 2021 in the scrape folder
 - There are subfolders in the analysis folder for:
- data preparation in the preparation folder,
 - fitting a hiearchical bayesian model for analysing German Landtag polls desc folder,
 - visulaizing results in the results_vis folder.
 
 
 
Detailed descriptions for all code files can be found in the respective folders.