Description Usage Format Details Source Examples
Loads clean version of presidential primaries polling data into the environment. This dataset includes polling data and elections outcomes for presidential primaries in 2000, 2004, 2008, 2012, and 2016.
1 |
Data are structured as one observation per poll. Variables include:
Year of election
Type of election race
State abbreviation
Organization conducingthe poll and weighting
The number of respondents who completed the poll
The date of the primary election
The name of the winning candidate
The percentage of respondents supporting the winning candidate
The name of the runner up (second place) candidate
The percentage of respondents supporting the runner up (second place) candidate
Reported margin of error for the surveys; calculated as the sample proportion of respondents supporting the Democratic candidate in unreported (commonly unreported for internet surveys)
Poll margin between candidates, calculated as (dem_poll-rep_poll)
Difference between the poll margin and vote margin, calculated as ((dem_poll-rep_poll)-(dem_vote-rep_vote))
Error on poll-vote margin, calculated as the absolute value of ((dem_poll-rep_poll)-(dem_vote-rep_vote))
Difference between Democrat and Republican vote, calculated as (dem_vote-rep_vote)
Indicator that the poll correctly predicted the winner: 1=yes, 0=no
These data were cleaned for the purpose of Data Science 1000 in the following way: variables with substantial missing data were removed (for example, if a variable was not reported in most years), and the margin of error was calculated where unreported using the sample proportion of respondents supporting the winning candidate.
The historical data comes from three sources. General election data (national presidential, statewide presidential, senate, and governor) prior to 2012 are from the National Council on Public Polls (http://www.ncpp.org/) website. National and Statewide presidential polls in 2016 are from the 2016 AAPOR Task Force on Pre-Election polls, as are the primary polls from 2000, 2004, 2008, and 2012. Data for the 2018 Midterm Elections was collected by a task force created in 2018 at the request of AAPOR Council President David Dutwin consisting of Evans Witt (PSRAI), Scott Clement (Washington Post) and Ariel Edwards-Levy (Huffington Post).
1 2 3 4 | # Run descriptive statistics on the data:
#hist(moe)
#table(winner)
#mean(sample_size)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.