Voter Data Questions
library(readr)
VoterData<-read_csv("/Users/juliushunte/Downloads/VOTER_Survey_July17_Release1-csv copy.csv")
## Parsed with column specification:
## cols(
## .default = col_integer(),
## weight_2017 = col_double(),
## redovote2016_t_2017 = col_character(),
## job_title_t_2017 = col_character(),
## weight_2016 = col_double(),
## izip_2016 = col_character(),
## presvote16post_t_2016 = col_character(),
## second_chance_t_2016 = col_character(),
## race_other_2016 = col_character(),
## healthcov_t_2016 = col_character(),
## employ_t_2016 = col_character(),
## pid3_t_2016 = col_character(),
## religpew_t_2016 = col_character(),
## votemeth16_rnd_2016 = col_character(),
## presvote16post_rnd_2016 = col_character(),
## vote2016_cand2_rnd_2016 = col_character(),
## Clinton_Rubio_rnd_2016 = col_character(),
## Clinton_Cruz_rnd_2016 = col_character(),
## Sanders_Trump_rnd_2016 = col_character(),
## Sanders_Rubio_rnd_2016 = col_character(),
## second_chance_rnd_2016 = col_character()
## # ... with 123 more columns
## )
## See spec(...) for full column specifications.
1. By how many percentage points did the winning candidates lead by in the democratic and republican primaries?
a. Using DemPrim and RepPrim data sets, the following tables reveal that Hillary was the preferred democratic primary candidate among 54% (DemPrim 1616) of people surveyed while Trump was the preferred republican primary candidate among 47% (RepPrim 1360) of people surveyed.
Democratic Primary Voter Distribution
Values
- Hillary Clinton - 1
- Bernie Sanders - 2
- Someone else - 3
- Don’t recall - 4
prop.table(table(VoterData$pp_demprim16_2016))
##
## 1 2 3 4
## 0.54337592 0.42434432 0.02151984 0.01075992
Republican Primary Voter Distribution
Values
- Donald Trump - 1
- John Kasich - 2
- Ted Cruz - 3
- Marco Rubio - 4
- Someone else - 5
- Don’t recall - 6
prop.table(table(VoterData$pp_repprim16_2016))
##
## 1 2 3 4 5 6
## 0.46799725 0.11975224 0.26152787 0.09428768 0.04335857 0.01307639
2. How many people who identify as politically democratic or republican are not registered to vote?
a. Using a cross tabulation of PartyReg and Post_pid3 data sets to find out what percentage of people who identified with each party, report being registered to that party?
Party Registration Voter Distribution
Values
- Democrat - 1
- Republican - 2
- Another Party - 3
- Declined to State/Independent/No party - 4
prop.table(table(VoterData$partyreg_baseline))
##
## 1 2 3 4
## 0.41818601 0.35610432 0.03646434 0.18924533
Point Party ID Voter Distribution
Values
- Democrat - 1
- Republican - 2
- Independent - 3
- Other - 4
- Not sure - 5
prop.table(table(VoterData$post_pid3_2012))
##
## 1 2 3 4 5
## 0.375500 0.288875 0.308875 0.013500 0.013250
Findings
- 51% of people who identify as democrats, report being registered as democrats.
- 52% of people who identify as republicans, report being registered as republicans.
- There are 1-2% of people who identify as democrat/republican, but are registered with the opposite party.
table(VoterData$partyreg_baseline,VoterData$post_pid3_2012)
##
## 1 2 3 4 5
## 1 1540 42 208 11 11
## 2 41 1210 249 29 14
## 3 14 3 129 11 1
## 4 66 44 682 10 18
DemRepTable<-table(VoterData$partyreg_baseline,VoterData$post_pid3_2012)
prop.table(DemRepTable,1)
##
## 1 2 3 4 5
## 1 0.849889625 0.023178808 0.114790287 0.006070640 0.006070640
## 2 0.026571614 0.784186649 0.161373947 0.018794556 0.009073234
## 3 0.088607595 0.018987342 0.816455696 0.069620253 0.006329114
## 4 0.080487805 0.053658537 0.831707317 0.012195122 0.021951220
3. What percentage of votes did the winning candidate have in the 2016 election and the 2012 election?
a. Using PresVote12 and PresVote16 data sets, results show that Barack Obama was the preferred candidate by 50% among 3734 votes out of a total of 7437 in the 2012 presidential election, while Donald Trump was the preferred candidate by 46% with 3479 votes out of a total of 7611 in the 2016 presidential election. Donald Trump won the election even though he fell second to Hillary Clinton by 1% and stood 4% shorter than Barack Obama did at the 2012 election.
Looking at how Votes were distributed for 2012 Election
Values
- Barack Obama - 1
- Mitt Romney - 2
- Other candidate - 3
- I did not vote in this race - 4
- I did not vote - 5
- Not sure - 6
prop.table(table(VoterData$post_presvote12_2012))
##
## 1 2 3 4 5
## 0.5024219591 0.4553283100 0.0374058127 0.0018837460 0.0001345533
## 6
## 0.0028256189
Looking at how Votes were distributed for 2016 Election
Values
- Hillary Clinton - 1
- Donald Trump - 2
- Gary Johnson - 3
- Jill Stein - 4
- Evan McMullin - 5
- Other - 6
- Did not vote for President - 7
prop.table(table(VoterData$presvote16post_2016))
##
## 1 2 3 4 5 6
## 0.466079411 0.457402051 0.030370760 0.014725217 0.003155404 0.023928478
## 7
## 0.004338680