Coder Social home page Coder Social logo

election-forecasting-kn-2017's Introduction

Workshop "Election Forecasting with R"

Code

  • 00-r-refresher.r: introduction to the most frequently used functions and operations
  • 01-fundamentals-models.r: how to build a fundamentals-based election forecasting model, with the German Federal election as a showcase
  • 02-prediction-markets.r: how to access and process odds from betting platforms
  • 03-web-data-models.r: how to access data from platforms such as Twitter, Wikipedia, and Google Trends
  • 04-scraping-wahlrecht.r: script to crawl polling data from wahlrecht.de
  • 05-prepare-wahlrecht.r: script to clean up wahlrecht data
  • 06-polling-model.r: replication code for Selb and Munzert 2016
  • 07-r-data-descriptives.r: code to prepare structural model dataset

Data

The data folder provides a bunch of Stata and R datasets relevant to build fundamentals- and polling-based forecasting models for the German federal election. They can be imported using either Stata or R. The datasets are:

  • election_results_ltw.dta: results of all German State elections ("Landtagswahlen") between 1946 and September 2016. Only results from the following parties are included: CDU, CSU, SPD, FDP, Greens, Left, NPD, AfD. The dataset also provides a variable election that reports the year of the Bundestag election following the respective state election, as well as a variable dist that reports the distance to the next Bundestag election in days. Use this dataset if you want to forecast state elections or want to use state election results to predict Bundestag election results.
  • ger_model_df.dta: results of all German Bundestag elections since 1949, together with many more variables. The units of this dataset are election-party units, i.e. each row represents one party in one election. Use this dataset if you want to forecast party-specific vote shares at the Bundestag election.
  • ger_nat.dta: results of all German Bundestag elections since 1949, together with many more variables. The units of this dataset are elections, i.e. each row represents one election. This dataset can be thought of as a replication dataset for Gschwend/Norpoth. Use this dataset if you want to build a forecasting model based on Gschwend/Norpoth and/or if you are interested in forecasting coalition vote shares or other national-level quantities, such as turnout.
  • polls_btw.RData: polling results for all major parties in Germany since 1998. The units of this dataset are poll-specific party results, i.e. it's a long format where one row reports the polling result for one party in one poll. Use this dataset if you are interested in aggregating polls.
  • polls_btw_wide.RData: polling results for all major parties in Germany since 1998. The units of this dataset are polls, i.e. it's a wide format where one row reports the result of one poll. Use this dataset if you are interested in aggregating polls.
  • polls_df_agg.RData: polling results, aggregated at the election level. The units of this dataset are aggregated polls by election and party. Several time windows are reported, e.g., the average polling performance of party X at election X, 200-230 days before the election. Use this dataset if you are interested in using aggregated polls in your forecasting model.

Instructor

Simon Munzert (website, Twitter)

election-forecasting-kn-2017's People

Contributors

simonmunzert avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jose8david

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.