• Stars
    star
    230
  • Rank 174,053 (Top 4 %)
  • Language
    R
  • License
    Other
  • Created over 10 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code and data for The Upshot's Senate model.

leo-senate-model

Leo combines polls with other information to predict how many Senate races Democrats and Republicans will win in 2014.

Leo uses:

Historical results from the Open Elections project, CQ Press Voting and Elections Collection, Dave Leipโ€™s Atlas of U.S. Presidential Elections, and the Federal Election Commission.

Fund-raising data from the Federal Election Commission. Biographical data from Project Vote Smart and candidate websites.

Polls aggregated by Pollster, the Roper Center for Public Opinion Research, the U.S. Officialsโ€™ Job Approval Ratings project, Polling Report, Gallup, Talking Points Memo, The Argo Journal, Real Clear Politics and FiveThirtyEight.

Brief instructions

  • Please make sure the following R packages have been installed: gam, gtools, lubridate, maps, RJSONIO, gdata, plotrix, zoo

  • Change directory to the top-level working directory of this Git repository.

  • Run: Rscript master-public.R

  • Prediction output can then be found in the data-publisher/public/_big_assets/ subdirectory.

Sample output data in /data-publisher/public/_big_assets

histogram.tsv
dem chance
44 0
45 0
46 0
47 0.05
48 0.25
49 0.15
50 0.3
51 0.15
matchups.tsv
statePostal secondary probability mean scale office dem rep
AK 0.0675992536643285 13.3371042222312 6.37706218633251 ak-senate-class-ii-2014 mark-begich joe-miller
AK 0.672480368777626 -0.369330147923164 6.40862522137136 ak-senate-class-ii-2014 mark-begich daniel-s-sullivan
AK 0.259920377558046 -1.42864965262853 6.43282051331378 ak-senate-class-ii-2014 mark-begich mead-treadwell
AL 1 -92.2586242817344 13.0668255800746 al-senate-class-ii-2014 NA jeff-sessions
AR 1 -0.588349828909989 5.43497477566511 ar-senate-class-ii-2014 mark-pryor thomas-cotton-1
CO 1 2.75130137738909 5.32999951709124 co-senate-class-ii-2014 mark-udall cory-gardner
DE 0.0485586168626867 22.1226995091985 12.2918575405219 de-senate-class-ii-2014 christopher-a-coons tom-kovach
DE 0.951441383137313 24.462299974418 12.2976359697371 de-senate-class-ii-2014 christopher-a-coons christine-o'donnell
nyt-ratings-today.json
{
  "date": "2014-04-22T13:19:49-0400",
  "data": [
    {
      "dem-pct": 49.428,
      "state": "AK",
      "office": "ak-senate-class-ii-2014",
      "fips": "2",
      "nyt-rating": 4
    },
    {
      "dem-pct": 4.1438E-10,
      "state": "AL",
      "office": "al-senate-class-ii-2014",
      "fips": "1",
      "nyt-rating": 7
    },
    {
      "dem-pct": 45.693,
      "state": "AR",
      "office": "ar-senate-class-ii-2014",
      "fips": "5",
      "nyt-rating": 4
    }
  ]
}
parameters.json
{
  "continuingSeats": {
    "dem": 34,
    "rep": 30
  },
  "nationalErrorScale": 0.40797,
  "upsetProb": 40,
  "houseEffect": 3.5,
  "mt": 85,
  "mtNum": "17",
  "mtDenom": "20",
  "aan": "an"
}
senate-likelihood-all.tsv
office date dem
ak-senate-class-ii-2014 1-Jan-14
ak-senate-class-ii-2014 25-Feb-14 51.4921956208518
ak-senate-class-ii-2014 22-Apr-14 49.4276015976854
al-senate-class-ii-2014 1-Jan-14
al-senate-class-ii-2014 25-Feb-14 9.22057393777991e-10
al-senate-class-ii-2014 22-Apr-14 4.14383203099536e-10
senate-likelihood.tsv
date dem
1-Jan-14 50
25-Feb-14 35
22-Apr-14 55
slug-lookup.tsv
slug name
mark-begich Mark Begich
william-bryk William Bryk
john-jaramillo John Jaramillo
joe-miller Joe Miller
sarah-palin Sarah Palin
daniel-s-sullivan Dan Sullivan
kathleen-tonn Kathleen Tonn
mead-treadwell Mead Treadwell

More Repositories

1

Military-Surplus-Gear

Military equipment given to law enforcement agencies
299
star
2

presidential-precinct-map-2020

The GeoJSON dataset behind our nationwide precinct map of the 2020 presidential general election
181
star
3

4thdownbot-model

The model behind @NYT4thDownBot
Python
114
star
4

statement

A Ruby gem that extracts press releases and statements by members of Congress.
HTML
70
star
5

chipotle

The data behind the Upshot's recent article about what people actually order at Chipotle
56
star
6

Bedfellows

Command-line tool for exploring the PAC donor-recipient relationship
Python
54
star
7

2018-live-poll-results

Data from the 2018 NYT Upshot/Siena live polls
28
star
8

2004-2012-presidential-election-model

R
24
star
9

prison-admissions

U.S. state prison admissions by county
R
18
star
10

ifill

Ruby wrapper for the Compilation of Presidential Documents.
Ruby
11
star
11

nyt_weddings

List of New York Times wedding announcements used in an Upshot story on name-changing.
9
star
12

Sunday-Shows

Sunday talk show guests
7
star
13

Ferguson-Demographics

Census data of communities resembling Ferguson, Mo.
7
star
14

voting_mistakes

5
star
15

2016-upshot-siena-polls

Data from the 2016 NYT Upshot/Siena voter file polls http://www.nytimes.com/2016/09/19/upshot/introducing-the-new-york-times-upshot-siena-college-poll.html
R
5
star
16

world-cup-study

5
star
17

EshooPallone

4
star
18

upshot-siena-va-gov-poll

Data and methodology
3
star
19

senate_precinct_results

Precinct-level results from 2014 general election in selected states with Senate races
2
star
20

ericpac

Recipients of contributions by ERIC PAC in 2013-2014 cycle
2
star
21

rand_paul_online_donors

A partial listing of online donors from April 7-May 3 pulled from randpaul.com
2
star
22

senate-forecast-comparison

Daily Senate forecasts from seven different forecasters
2
star
23

state-department-press-briefings

The data behind our calendar of State department press briefings.
1
star