GithubHelp home page GithubHelp logo

presidential-forecasts-2016's Introduction

Presidential-Forecasts-2016

Function to scrape, format, and plot forecaster data for the 2016 U.S. Presidential Election

For information about the SAFE model and other data about the election, see here.

How to use the pres_forecasts function

The pres_forecasts function will first scrape the state-level forecasts aggregated by The Upshot:

alt text

After scraping the data, the function will extract the numerical data from each state/forecaster cell, melt the data, and then create variables for the numerical probability of a Democratic and Republican victory for each state/forecaster combination.

alt text

The data is then re-cast so that average probabilities can be calculated across the six forecasters. This is done for both parties, with cumulative electoral votes calculated sorted by the probability of a party winning a state. A date column is also added.

alt text

Three plots are also provided. The first plots the cumulative probability for each party in a faceted chart, with a dashed horizontal line plotted at 270 electoral votes. The second plot simply combines both parties into one chart. And, finally, the third plots each of the forecasters in a comparative way based on data from the current date.

alt text alt text
alt text

The function will also assign the plots and two main data sets to the Global Environment as well as exporting them to the working directory with a unique name based on the date the function was run.

presidential-forecasts-2016's People

Contributors

billpetti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.