#install.packages("readr")
library(readr)
library(knitr)
#Right Path
voterdata<-read_csv("/Users/meiminshan/Desktop/Abbreviated Dataset Labeled(October Only)(1).csv")
## Parsed with column specification:
## cols(
## .default = col_character(),
## NumChildren = col_double()
## )
## See spec(...) for full column specifications.
head(voterdata)
## # A tibble: 6 x 34
## gender race education familyincome children region urbancity Vote2012
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 Female White 4-year Prefer not … No West Suburb Barack …
## 2 Female White Some Col… $60K-$69,999 No West Rural Ar… Mitt Ro…
## 3 Male White High Sch… $50K-$59,999 No Midwe… City Mitt Ro…
## 4 Male White Some Col… $70K-$79,999 No South City Barack …
## 5 Male White 4-year $40K-$49,999 No South Suburb Mitt Ro…
## 6 Female White 2-year $30K-$39,999 No West Suburb Barack …
## # … with 26 more variables: Vote2016 <chr>, TrumpSanders <chr>,
## # PartyRegistration <chr>, PartyIdentification <chr>,
## # PartyIdentification2 <chr>, PartyIdentification3 <chr>,
## # NewsPublicAffairs <chr>, DemPrimary <chr>, RepPrimary <chr>,
## # ImmigrantContributions <chr>, ImmigrantNaturalization <chr>,
## # ImmigrationShouldBe <chr>, Abortion <chr>, GayMarriage <chr>,
## # DeathPenalty <chr>, DeathPenaltyFreq <chr>, TaxWealthy <chr>,
## # Healthcare <chr>, GlobWarmExist <chr>, GlobWarmingSerious <chr>,
## # AffirmativeAction <chr>, Religion <chr>, ReligiousImportance <chr>,
## # ChurchAttendance <chr>, PrayerFrequency <chr>, NumChildren <dbl>
Crosstabs
Do male & female respondents differ in whether or not they think it should be easier or harder for foreigners to immigrate to the United States legally?
Yes, it appears that men think it should be easier for foreigners to immigrate to the United States legally more than women. Women think it should be harder for foreigners to immigrate to the United States legally more than men.
prop.table(table(voterdata$ImmigrationShouldBe, voterdata$gender),2)
##
## Female Male
## Much Easier 0.07587404 0.10577414
## Much Harder 0.26729482 0.20132856
## No change 0.21224895 0.27133367
## Not Sure 0.09546243 0.04317833
## Slightly Easier 0.15893876 0.20235054
## Slightly Harder 0.19018101 0.17603475
Do male & female respondents differ in their support for allowing gays and lesbians to marry legally?
Yes, it appears that women are supporting gays and lesbians to marry legally more than men. Men are more likely to disagree gays and lesbians to marry legally than women.
prop.table(table(voterdata$GayMarriage, voterdata$gender),1)
##
## Female Male
## Favor 0.5605344 0.4394656
## Not sure 0.5744235 0.4255765
## Oppose 0.4342874 0.5657126
Do different ethnic groups differ in having number of children?
Yes, it appears that Black, Hispanic, Mixed, Native American Mixed, Other and White are more likely to have 0 children. Asian and Middle Eastern are more likely to have no more than 3 children.
prop.table(table(voterdata$NumChildren, voterdata$race),2)
##
## Asian Black HIspanic Middle Eastern Mixed
## 0 0.6410256410 0.7620481928 0.7333333333 0.4000000000 0.7515151515
## 1 0.1965811966 0.1189759036 0.1012345679 0.1000000000 0.1454545455
## 2 0.1367521368 0.0753012048 0.1135802469 0.3000000000 0.0787878788
## 3 0.0256410256 0.0331325301 0.0345679012 0.2000000000 0.0121212121
## 4 0.0000000000 0.0060240964 0.0098765432 0.0000000000 0.0000000000
## 5 0.0000000000 0.0015060241 0.0000000000 0.0000000000 0.0000000000
## 6 0.0000000000 0.0015060241 0.0049382716 0.0000000000 0.0060606061
## 7 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## 8 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## 9 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## 15 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0060606061
## 16 0.0000000000 0.0015060241 0.0000000000 0.0000000000 0.0000000000
## 17 0.0000000000 0.0000000000 0.0024691358 0.0000000000 0.0000000000
## 20 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000
##
## Native American Mixed Other White
## 0 0.7118644068 0.7318840580 0.7870385042
## 1 0.1694915254 0.1304347826 0.1025194106
## 2 0.0508474576 0.0724637681 0.0763745841
## 3 0.0338983051 0.0362318841 0.0244018381
## 4 0.0000000000 0.0072463768 0.0064965932
## 5 0.0169491525 0.0144927536 0.0017429884
## 6 0.0000000000 0.0000000000 0.0011091745
## 7 0.0000000000 0.0000000000 0.0001584535
## 8 0.0169491525 0.0000000000 0.0000000000
## 9 0.0000000000 0.0000000000 0.0001584535
## 15 0.0000000000 0.0000000000 0.0000000000
## 16 0.0000000000 0.0000000000 0.0000000000
## 17 0.0000000000 0.0000000000 0.0000000000
## 20 0.0000000000 0.0072463768 0.0000000000
Do male and female responders differ in their support for raising taxes on families with incomes over $200,000 per year?
Yes, it appears that female responders are more likely to support raising taxes on families with incomes over $200, 000 per year. Male responders are more likely to oppose raising taxes on families with incomes over $200, 000 per year.
prop.table(table(voterdata$TaxWealthy, voterdata$gender),1)
##
## Female Male
## Favor 0.5668203 0.4331797
## Not sure 0.6364764 0.3635236
## Oppose 0.3453027 0.6546973
Conclusions:
Male respondents are more likely than female respondents to believe it should be easier for foreigners to immigrate to the United States legally.
Female respondents are more likely than male respondents to support gays and lesbians to marry legally.
Black, Hsipanic, Mixed, Native American Mixed, Other, and White are more likely than Asian and Middle Eastern to have either 0 children or more than 3 children.
Female respondents are more likely than male respondents to support raising taxes on families with incomes over $200,000 per year.