Safiya

Sociology 333

Professor Turner

9/29/2018

Assignment 4: Replicate Voter Analysis in R

  • Question 1:

Does the type of area you live affect family income?

Variables used were:

  • Type of area (urbancity_baseline) which is the independent variable and Family Income (faminc_2016) which is the dependent variable

The categories for the Independent variable are:-

1 City

2 Suburb

3 Town

4 Rural Area

5 Other

The categories for the Dependent variable were placed into 5 intervals for compactness, they are:-

1-5 $0-49,000

6-9 $50,000-99,000

10-13 $100,000-249,000

14-31 $250,000-larger

32-97 Other (respondents preferred not to say)

The below proportion table shows the income earned of respondents based on the area lived. For example, those earning $0-49,000 typically live in the city

*Question # 2

Does education level have an impact on political ideology?

Education level (educ_baseline) which is the independent variable and Political ideology (post_ideo5_2012) which is the dependent variable

The categories for the Independent variable are:-

1 No high school

2 High School graduate

3 Some college

4 Two year

5 Four year

6 Post grad

The categories for the Dependent variable are:-

1 Very liberal

2 Liberal

3 Moderate

4 Conservative

5 Very conservative

Important to note that categories listed as not sure or other were ommitted due to it being insignificant in this question

The below proportion table shows the respondent’s political ideology with that of their education level. The findings show that those with a four year degree tend to be very liberal

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00
VoterData<-read_csv("/Users/safiesaf/Downloads/VOTER_Survey_July17_Release1-csv.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.
table(VoterData$educ_baseline,VoterData$post_ideo5_2012)
##    
##       1   2   3   4   5   6
##   1   7  19  45  48  23  24
##   2  94 263 650 599 241 130
##   3 133 336 661 492 183  69
##   4  38 123 299 222  75  27
##   5 187 376 690 495 182  42
##   6 116 269 422 276 100  27
EduIdeo<-table(VoterData$educ_baseline,VoterData$post_ideo5_2012)

print(EduIdeo)
##    
##       1   2   3   4   5   6
##   1   7  19  45  48  23  24
##   2  94 263 650 599 241 130
##   3 133 336 661 492 183  69
##   4  38 123 299 222  75  27
##   5 187 376 690 495 182  42
##   6 116 269 422 276 100  27
prop.table(EduIdeo,2)
##    
##              1          2          3          4          5          6
##   1 0.01217391 0.01370851 0.01626310 0.02251407 0.02860697 0.07523511
##   2 0.16347826 0.18975469 0.23491146 0.28095685 0.29975124 0.40752351
##   3 0.23130435 0.24242424 0.23888688 0.23076923 0.22761194 0.21630094
##   4 0.06608696 0.08874459 0.10805927 0.10412758 0.09328358 0.08463950
##   5 0.32521739 0.27128427 0.24936755 0.23217636 0.22636816 0.13166144
##   6 0.20173913 0.19408369 0.15251175 0.12945591 0.12437811 0.08463950
CrossTable(EduIdeo)
## 
##  
##    Cell Contents
## |-------------------------|
## |                       N |
## | Chi-square contribution |
## |           N / Row Total |
## |           N / Col Total |
## |         N / Table Total |
## |-------------------------|
## 
##  
## Total Observations in Table:  7983 
## 
##  
##              |  
##              |         1 |         2 |         3 |         4 |         5 |         6 | Row Total | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            1 |         7 |        19 |        45 |        48 |        23 |        24 |       166 | 
##              |     2.055 |     3.346 |     2.732 |     0.303 |     2.360 |    45.467 |           | 
##              |     0.042 |     0.114 |     0.271 |     0.289 |     0.139 |     0.145 |     0.021 | 
##              |     0.012 |     0.014 |     0.016 |     0.023 |     0.029 |     0.075 |           | 
##              |     0.001 |     0.002 |     0.006 |     0.006 |     0.003 |     0.003 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            2 |        94 |       263 |       650 |       599 |       241 |       130 |      1977 | 
##              |    16.450 |    18.760 |     1.813 |     9.550 |     8.812 |    32.923 |           | 
##              |     0.048 |     0.133 |     0.329 |     0.303 |     0.122 |     0.066 |     0.248 | 
##              |     0.163 |     0.190 |     0.235 |     0.281 |     0.300 |     0.408 |           | 
##              |     0.012 |     0.033 |     0.081 |     0.075 |     0.030 |     0.016 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            3 |       133 |       336 |       661 |       492 |       183 |        69 |      1874 | 
##              |     0.029 |     0.348 |     0.202 |     0.144 |     0.174 |     0.462 |           | 
##              |     0.071 |     0.179 |     0.353 |     0.263 |     0.098 |     0.037 |     0.235 | 
##              |     0.231 |     0.242 |     0.239 |     0.231 |     0.228 |     0.216 |           | 
##              |     0.017 |     0.042 |     0.083 |     0.062 |     0.023 |     0.009 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            4 |        38 |       123 |       299 |       222 |        75 |        27 |       784 | 
##              |     6.041 |     1.264 |     2.734 |     0.761 |     0.199 |     0.598 |           | 
##              |     0.048 |     0.157 |     0.381 |     0.283 |     0.096 |     0.034 |     0.098 | 
##              |     0.066 |     0.089 |     0.108 |     0.104 |     0.093 |     0.085 |           | 
##              |     0.005 |     0.015 |     0.037 |     0.028 |     0.009 |     0.003 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            5 |       187 |       376 |       690 |       495 |       182 |        42 |      1972 | 
##              |    14.232 |     3.302 |     0.061 |     1.903 |     1.389 |    17.186 |           | 
##              |     0.095 |     0.191 |     0.350 |     0.251 |     0.092 |     0.021 |     0.247 | 
##              |     0.325 |     0.271 |     0.249 |     0.232 |     0.226 |     0.132 |           | 
##              |     0.023 |     0.047 |     0.086 |     0.062 |     0.023 |     0.005 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            6 |       116 |       269 |       422 |       276 |       100 |        27 |      1210 | 
##              |     9.547 |    16.526 |     0.016 |     6.880 |     3.923 |     9.429 |           | 
##              |     0.096 |     0.222 |     0.349 |     0.228 |     0.083 |     0.022 |     0.152 | 
##              |     0.202 |     0.194 |     0.153 |     0.129 |     0.124 |     0.085 |           | 
##              |     0.015 |     0.034 |     0.053 |     0.035 |     0.013 |     0.003 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## Column Total |       575 |      1386 |      2767 |      2132 |       804 |       319 |      7983 | 
##              |     0.072 |     0.174 |     0.347 |     0.267 |     0.101 |     0.040 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 
## 

*Question # 3

Does who you vote for in the 2016 election have an impact on immigration reform?

2016 Voter Election (presvote16post_2016) which is the independent variable and Immigration reform (immi_makedifficult_baseline) which is the dependent variable

The categories for the Independent variable are:-

1 Hillary Clinton

2 Donald Trump

3 Gary Johnson

4 Jill Stein

5 Evan McMullin

The categories for the Dependent variable are:-

1 Much easier

2 Slightly easier

3 No change

4 Slightly harder

5 Much harder

Important to note that categories listed as not sure or other were ommitted due to it being insignificant in this question

The proportion table highlights the opinions of respondents when it comes to foreigners immigrating to the US legally with that of the political candidate they voted for in the 2016 election. The table shows that the majority of those that believe it should be much easier for foreigners to immigrate to the United States, voted for Hillary Clinton.

## 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    2    3    4    5    8
##   1  406  766  847  640  546  313
##   2  203  501  879  640 1091  145
##   3   37   55   42   40   45   11
##   4   19   25   21   17   17   13
##   5    5    8    5    2    2    2
##   6   20   41   42   29   36   12
##   7    2    4    6   10   10    1
##    
##        1    2    3    4    5    8
##   1  406  766  847  640  546  313
##   2  203  501  879  640 1091  145
##   3   37   55   42   40   45   11
##   4   19   25   21   17   17   13
##   5    5    8    5    2    2    2
##   6   20   41   42   29   36   12
##   7    2    4    6   10   10    1
##    
##               1           2           3           4           5
##   1 0.586705202 0.547142857 0.459826276 0.464441219 0.312535776
##   2 0.293352601 0.357857143 0.477198697 0.464441219 0.624499141
##   3 0.053468208 0.039285714 0.022801303 0.029027576 0.025758443
##   4 0.027456647 0.017857143 0.011400651 0.012336720 0.009730967
##   5 0.007225434 0.005714286 0.002714441 0.001451379 0.001144820
##   6 0.028901734 0.029285714 0.022801303 0.021044993 0.020606754
##   7 0.002890173 0.002857143 0.003257329 0.007256894 0.005724098
##    
##               8
##   1 0.629778672
##   2 0.291750503
##   3 0.022132797
##   4 0.026156942
##   5 0.004024145
##   6 0.024144869
##   7 0.002012072
## 
##  
##    Cell Contents
## |-------------------------|
## |                       N |
## | Chi-square contribution |
## |           N / Row Total |
## |           N / Col Total |
## |         N / Table Total |
## |-------------------------|
## 
##  
## Total Observations in Table:  7556 
## 
##  
##              |  
##              |         1 |         2 |         3 |         4 |         5 |         8 | Row Total | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            1 |       406 |       766 |       847 |       640 |       546 |       313 |      3518 | 
##              |    21.802 |    19.999 |     0.131 |     0.004 |    87.898 |    28.776 |           | 
##              |     0.115 |     0.218 |     0.241 |     0.182 |     0.155 |     0.089 |     0.466 | 
##              |     0.587 |     0.547 |     0.460 |     0.464 |     0.313 |     0.630 |           | 
##              |     0.054 |     0.101 |     0.112 |     0.085 |     0.072 |     0.041 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            2 |       203 |       501 |       879 |       640 |      1091 |       145 |      3459 | 
##              |    40.870 |    30.536 |     1.517 |     0.133 |   106.071 |    29.928 |           | 
##              |     0.059 |     0.145 |     0.254 |     0.185 |     0.315 |     0.042 |     0.458 | 
##              |     0.293 |     0.358 |     0.477 |     0.464 |     0.624 |     0.292 |           | 
##              |     0.027 |     0.066 |     0.116 |     0.085 |     0.144 |     0.019 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            3 |        37 |        55 |        42 |        40 |        45 |        11 |       230 | 
##              |    12.056 |     3.599 |     3.530 |     0.090 |     1.258 |     1.127 |           | 
##              |     0.161 |     0.239 |     0.183 |     0.174 |     0.196 |     0.048 |     0.030 | 
##              |     0.053 |     0.039 |     0.023 |     0.029 |     0.026 |     0.022 |           | 
##              |     0.005 |     0.007 |     0.006 |     0.005 |     0.006 |     0.001 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            4 |        19 |        25 |        21 |        17 |        17 |        13 |       112 | 
##              |     7.452 |     0.870 |     1.455 |     0.575 |     3.056 |     4.307 |           | 
##              |     0.170 |     0.223 |     0.188 |     0.152 |     0.152 |     0.116 |     0.015 | 
##              |     0.027 |     0.018 |     0.011 |     0.012 |     0.010 |     0.026 |           | 
##              |     0.003 |     0.003 |     0.003 |     0.002 |     0.002 |     0.002 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            5 |         5 |         8 |         5 |         2 |         2 |         2 |        24 | 
##              |     3.572 |     2.839 |     0.124 |     1.291 |     2.270 |     0.112 |           | 
##              |     0.208 |     0.333 |     0.208 |     0.083 |     0.083 |     0.083 |     0.003 | 
##              |     0.007 |     0.006 |     0.003 |     0.001 |     0.001 |     0.004 |           | 
##              |     0.001 |     0.001 |     0.001 |     0.000 |     0.000 |     0.000 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            6 |        20 |        41 |        42 |        29 |        36 |        12 |       180 | 
##              |     0.750 |     1.754 |     0.081 |     0.446 |     0.758 |     0.002 |           | 
##              |     0.111 |     0.228 |     0.233 |     0.161 |     0.200 |     0.067 |     0.024 | 
##              |     0.029 |     0.029 |     0.023 |     0.021 |     0.021 |     0.024 |           | 
##              |     0.003 |     0.005 |     0.006 |     0.004 |     0.005 |     0.002 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##            7 |         2 |         4 |         6 |        10 |        10 |         1 |        33 | 
##              |     0.346 |     0.731 |     0.520 |     2.634 |     0.736 |     0.631 |           | 
##              |     0.061 |     0.121 |     0.182 |     0.303 |     0.303 |     0.030 |     0.004 | 
##              |     0.003 |     0.003 |     0.003 |     0.007 |     0.006 |     0.002 |           | 
##              |     0.000 |     0.001 |     0.001 |     0.001 |     0.001 |     0.000 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## Column Total |       692 |      1400 |      1842 |      1378 |      1747 |       497 |      7556 | 
##              |     0.092 |     0.185 |     0.244 |     0.182 |     0.231 |     0.066 |           | 
## -------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 
##