Much of the data was duplicated from the reading.
My hypothesis is that during the 1948 election race and gender were both factors in voting much like today.
If you look at the first crosstab table which covers race of the respondent you can see that: 31.7% voted for Truman, 27.5% voted for Dewey, .2% voted for Wallace, 1.7% voted for other and 35.9% did not vote. Overall whites make up 90.7% of the sample while blacks only make up 9.3% of the sample. This might be due to sample error or because the population of blacks is much smaller than the population of white. If you were to look at the candidates that each race voted for you would notice that only 17 blacks voted in the election which is a minority of the race. Most blacks did not vote at all but judging by the ones that did vote the majority did vote for Truman just like whites had. Race does not seem to be a factor in voting.
When you look at the 2nd crosstab table which covers gender and voting you will see that: 32.1% voted for Truman, 27.1% voted for Dewey, .2% voted for Wallace and 36% did not vote at all. Of the people who did not vote 61.2% were women. When trying to figure out of sex has a factor in the selection of candidates you can see that females voted the same way as males but because such a high percentage of females in the respondent population did not vote it might be an inaccurate assumption to make but based on the data not only is race not a factor but sex is not either.
In the 3rd cross tab table you can see that education does in fact play a factor in the canidates that each respondant had picked. This is obvious when you look at the college educated respondants 8.1% had voted for Truman while 30.3% had voted for Dewey which is a very large grab.
In conclusion: Education plays more of a part in an election that race or gender.
library(Zelig)
## Loading required package: boot
## Loading required package: MASS
## Loading required package: sandwich
## ZELIG (Versions 4.2-1, built: 2013-09-12)
##
## +----------------------------------------------------------------+
## | Please refer to http://gking.harvard.edu/zelig for full |
## | documentation or help.zelig() for help with commands and |
## | models support by Zelig. |
## | |
## | Zelig project citations: |
## | Kosuke Imai, Gary King, and Olivia Lau. (2009). |
## | ``Zelig: Everyone's Statistical Software,'' |
## | http://gking.harvard.edu/zelig |
## | and |
## | Kosuke Imai, Gary King, and Olivia Lau. (2008). |
## | ``Toward A Common Framework for Statistical Analysis |
## | and Development,'' Journal of Computational and |
## | Graphical Statistics, Vol. 17, No. 4 (December) |
## | pp. 892-913. |
## | |
## | To cite individual Zelig models, please use the citation |
## | format printed with each model run and in the documentation. |
## +----------------------------------------------------------------+
##
##
##
## Attaching package: 'Zelig'
##
## The following object is masked from 'package:utils':
##
## cite
library(DescTools)
##
## Attaching package: 'DescTools'
##
## The following object is masked from 'package:Zelig':
##
## Mode
library(stargazer)
##
## Please cite as:
##
## Hlavac, Marek (2014). stargazer: LaTeX code and ASCII text for well-formatted regression and summary statistics tables.
## R package version 5.1. http://CRAN.R-project.org/package=stargazer
library(dplyr)
##
## Attaching package: 'dplyr'
##
## The following objects are masked from 'package:Zelig':
##
## combine, summarize
##
## The following object is masked from 'package:MASS':
##
## select
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(scatterplot3d)
library(tidyr)
library(memisc)
## Loading required package: lattice
##
## Attaching package: 'lattice'
##
## The following object is masked from 'package:boot':
##
## melanoma
##
##
## Attaching package: 'memisc'
##
## The following objects are masked from 'package:dplyr':
##
## collect, query, rename
##
## The following object is masked from 'package:DescTools':
##
## %nin%
##
## The following object is masked from 'package:Zelig':
##
## description
##
## The following objects are masked from 'package:stats':
##
## contr.sum, contr.treatment, contrasts
##
## The following object is masked from 'package:base':
##
## as.array
library(pander)
library(gmodels)
library(Hmisc)
## Loading required package: grid
## Loading required package: survival
##
## Attaching package: 'survival'
##
## The following object is masked from 'package:boot':
##
## aml
##
## Loading required package: Formula
## Loading required package: ggplot2
##
## Attaching package: 'Hmisc'
##
## The following object is masked from 'package:memisc':
##
## %nin%
##
## The following objects are masked from 'package:dplyr':
##
## combine, src, summarize
##
## The following objects are masked from 'package:DescTools':
##
## %nin%, Label, Label.data.frame
##
## The following objects are masked from 'package:Zelig':
##
## combine, describe, describe.default, summarize
##
## The following objects are masked from 'package:base':
##
## format.pval, round.POSIXt, trunc.POSIXt, units
library(car)
##
## Attaching package: 'car'
##
## The following object is masked from 'package:memisc':
##
## recode
##
## The following object is masked from 'package:DescTools':
##
## Recode
##
## The following object is masked from 'package:boot':
##
## logit
options(digits=3)
nes1948.por <- UnZip("anes/NES1948.ZIP","NES1948.POR",package="memisc")
nes1948 <- spss.portable.file(nes1948.por)
print(nes1948)
##
## SPSS portable file 'C:/Users/ROBERT~1/AppData/Local/Temp/RtmpQnaM3K/NES1948.POR'
## with 67 variables and 662 observations
vote.48 <- subset(nes1948,
select=c(
v480018,
v480027,
v480029,
v480030,
v480045,
v480046,
v480047,
v480048,
v480049,
v480050
))
str(vote.48)
## Data set with 662 obs. of 10 variables:
## $ v480018: Nmnl. item w/ 7 labels for 1,2,3,... + ms.v. num 1 2 1 2 1 2 2 1 2 1 ...
## $ v480027: Nmnl. item w/ 8 labels for 1,2,3,... + ms.v. num 1 2 1 2 1 2 2 4 2 6 ...
## $ v480029: Nmnl. item w/ 12 labels for 10,20,30,... + ms.v. num 70 30 40 10 10 20 80 80 40 40 ...
## $ v480030: Nmnl. item w/ 4 labels for 1,2,8,... + ms.v. num 1 2 2 2 2 2 2 2 1 1 ...
## $ v480045: Nmnl. item w/ 3 labels for 1,2,9 + ms.v. num 1 2 2 2 1 2 1 2 1 1 ...
## $ v480046: Nmnl. item w/ 4 labels for 1,2,3,... + ms.v. num 1 1 1 1 1 1 1 1 1 1 ...
## $ v480047: Nmnl. item w/ 7 labels for 1,2,3,... + ms.v. num 3 3 2 3 2 3 4 5 2 2 ...
## $ v480048: Nmnl. item w/ 4 labels for 1,2,3,... + ms.v. num 1 2 2 3 3 2 1 1 2 2 ...
## $ v480049: Nmnl. item w/ 8 labels for 1,2,3,... + ms.v. num 4 7 5 7 5 7 5 2 5 6 ...
## $ v480050: Nmnl. item w/ 6 labels for 1,2,3,... + ms.v. num 1 1 2 1 2 1 1 1 1 2 ...
vote.48 <- spss.get("C:\\Users\\Robert Johnson\\RSquared\\anes1948.POR", use.value.labels=TRUE)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
vote.48<-rename(vote.48, V480018="vote", V480029="Occupation.hh", V480045="gender", V480046="race", V480047="age", V480048="education", V480049="total.income", V480050="religious.pref")
plot(vote.48$vote)
PercTable(vote.48$Occupation.hh)
## freq perc
##
## PROFESSIONAL, SEMI-PROFESSIONAL 44 .069
## SELF-EMPLOYED, MANAGERIAL, SUPERVISORY 73 .115
## OTHER WHITE-COLLAR (CLERICAL, SALES, ET 79 .125
## SKILLED AND SEMI-SKILLED 164 .259
## PROTECTIVE SERVICE 6 .009
## UNSKILLED, INCLUDING FARM AND SERVICE W 85 .134
## FARM OPERATORS AND MANAGERS 105 .166
## STUDENT 7 .011
## UNEMPLOYED 5 .008
## RETIRED, TOO OLD OR UNABLE TO WORK 38 .060
## HOUSEWIFE 28 .044
PercTable(vote.48$gender)
## freq perc
##
## MALE 302 .458
## FEMALE 357 .542
PercTable(vote.48$age)
## freq perc
##
## 18-24 57 .087
## 25-34 142 .217
## 35-44 174 .266
## 45-54 125 .191
## 55-64 86 .131
## 65 AND OVER 70 .107
PercTable(vote.48$education)
## freq perc
##
## GRADE SCHOOL 292 .444
## HIGH SCHOOL 266 .404
## COLLEGE 100 .152
PercTable(vote.48$total.income)
## freq perc
##
## UNDER $500 25 .038
## $500-$999 43 .066
## $1000-1999 110 .168
## $2000-2999 185 .282
## $3000-3999 142 .217
## $4000-4999 66 .101
## $5000 AND OVER 84 .128
PercTable(vote.48$religious.pref)
## freq perc
##
## PROTESTANT 460 .700
## CATHOLIC 140 .213
## JEWISH 25 .038
## OTHER 14 .021
## NONE 18 .027
crsst<-CrossTable(vote.48$vote, vote.48$race)
##
##
## Cell Contents
## |-------------------------|
## | N |
## | Chi-square contribution |
## | N / Row Total |
## | N / Col Total |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 643
##
##
## | vote.48$race
## vote.48$vote | WHITE | NEGRO | Row Total |
## --------------------|-----------|-----------|-----------|
## VOTED - FOR TRUMAN | 193 | 11 | 204 |
## | 0.349 | 3.392 | |
## | 0.946 | 0.054 | 0.317 |
## | 0.331 | 0.183 | |
## | 0.300 | 0.017 | |
## --------------------|-----------|-----------|-----------|
## VOTED - FOR DEWEY | 171 | 6 | 177 |
## | 0.689 | 6.696 | |
## | 0.966 | 0.034 | 0.275 |
## | 0.293 | 0.100 | |
## | 0.266 | 0.009 | |
## --------------------|-----------|-----------|-----------|
## VOTED - FOR WALLACE | 1 | 0 | 1 |
## | 0.010 | 0.093 | |
## | 1.000 | 0.000 | 0.002 |
## | 0.002 | 0.000 | |
## | 0.002 | 0.000 | |
## --------------------|-----------|-----------|-----------|
## VOTED - FOR OTHER | 11 | 0 | 11 |
## | 0.106 | 1.026 | |
## | 1.000 | 0.000 | 0.017 |
## | 0.019 | 0.000 | |
## | 0.017 | 0.000 | |
## --------------------|-----------|-----------|-----------|
## VOTED - NA FOR WHOM | 14 | 5 | 19 |
## | 0.605 | 5.874 | |
## | 0.737 | 0.263 | 0.030 |
## | 0.024 | 0.083 | |
## | 0.022 | 0.008 | |
## --------------------|-----------|-----------|-----------|
## DID NOT VOTE | 193 | 38 | 231 |
## | 1.291 | 12.546 | |
## | 0.835 | 0.165 | 0.359 |
## | 0.331 | 0.633 | |
## | 0.300 | 0.059 | |
## --------------------|-----------|-----------|-----------|
## Column Total | 583 | 60 | 643 |
## | 0.907 | 0.093 | |
## --------------------|-----------|-----------|-----------|
##
##
crsst2<-CrossTable(vote.48$vote, vote.48$gender)
##
##
## Cell Contents
## |-------------------------|
## | N |
## | Chi-square contribution |
## | N / Row Total |
## | N / Col Total |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 658
##
##
## | vote.48$gender
## vote.48$vote | MALE | FEMALE | Row Total |
## --------------------|-----------|-----------|-----------|
## VOTED - FOR TRUMAN | 108 | 103 | 211 |
## | 1.365 | 1.151 | |
## | 0.512 | 0.488 | 0.321 |
## | 0.359 | 0.289 | |
## | 0.164 | 0.157 | |
## --------------------|-----------|-----------|-----------|
## VOTED - FOR DEWEY | 86 | 92 | 178 |
## | 0.257 | 0.217 | |
## | 0.483 | 0.517 | 0.271 |
## | 0.286 | 0.258 | |
## | 0.131 | 0.140 | |
## --------------------|-----------|-----------|-----------|
## VOTED - FOR WALLACE | 0 | 1 | 1 |
## | 0.457 | 0.386 | |
## | 0.000 | 1.000 | 0.002 |
## | 0.000 | 0.003 | |
## | 0.000 | 0.002 | |
## --------------------|-----------|-----------|-----------|
## VOTED - FOR OTHER | 4 | 7 | 11 |
## | 0.212 | 0.178 | |
## | 0.364 | 0.636 | 0.017 |
## | 0.013 | 0.020 | |
## | 0.006 | 0.011 | |
## --------------------|-----------|-----------|-----------|
## VOTED - NA FOR WHOM | 11 | 9 | 20 |
## | 0.375 | 0.316 | |
## | 0.550 | 0.450 | 0.030 |
## | 0.037 | 0.025 | |
## | 0.017 | 0.014 | |
## --------------------|-----------|-----------|-----------|
## DID NOT VOTE | 92 | 145 | 237 |
## | 2.485 | 2.095 | |
## | 0.388 | 0.612 | 0.360 |
## | 0.306 | 0.406 | |
## | 0.140 | 0.220 | |
## --------------------|-----------|-----------|-----------|
## Column Total | 301 | 357 | 658 |
## | 0.457 | 0.543 | |
## --------------------|-----------|-----------|-----------|
##
##
crsst3<-CrossTable(vote.48$vote, vote.48$education)
##
##
## Cell Contents
## |-------------------------|
## | N |
## | Chi-square contribution |
## | N / Row Total |
## | N / Col Total |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 656
##
##
## | vote.48$education
## vote.48$vote | GRADE SCHOOL | HIGH SCHOOL | COLLEGE | Row Total |
## --------------------|--------------|--------------|--------------|--------------|
## VOTED - FOR TRUMAN | 102 | 90 | 17 | 209 |
## | 0.931 | 0.368 | 6.931 | |
## | 0.488 | 0.431 | 0.081 | 0.319 |
## | 0.351 | 0.340 | 0.170 | |
## | 0.155 | 0.137 | 0.026 | |
## --------------------|--------------|--------------|--------------|--------------|
## VOTED - FOR DEWEY | 48 | 76 | 54 | 178 |
## | 12.140 | 0.233 | 26.600 | |
## | 0.270 | 0.427 | 0.303 | 0.271 |
## | 0.165 | 0.287 | 0.540 | |
## | 0.073 | 0.116 | 0.082 | |
## --------------------|--------------|--------------|--------------|--------------|
## VOTED - FOR WALLACE | 0 | 1 | 0 | 1 |
## | 0.444 | 0.879 | 0.152 | |
## | 0.000 | 1.000 | 0.000 | 0.002 |
## | 0.000 | 0.004 | 0.000 | |
## | 0.000 | 0.002 | 0.000 | |
## --------------------|--------------|--------------|--------------|--------------|
## VOTED - FOR OTHER | 5 | 3 | 3 | 11 |
## | 0.003 | 0.469 | 1.044 | |
## | 0.455 | 0.273 | 0.273 | 0.017 |
## | 0.017 | 0.011 | 0.030 | |
## | 0.008 | 0.005 | 0.005 | |
## --------------------|--------------|--------------|--------------|--------------|
## VOTED - NA FOR WHOM | 7 | 8 | 5 | 20 |
## | 0.395 | 0.001 | 1.249 | |
## | 0.350 | 0.400 | 0.250 | 0.030 |
## | 0.024 | 0.030 | 0.050 | |
## | 0.011 | 0.012 | 0.008 | |
## --------------------|--------------|--------------|--------------|--------------|
## DID NOT VOTE | 129 | 87 | 21 | 237 |
## | 5.418 | 0.798 | 6.335 | |
## | 0.544 | 0.367 | 0.089 | 0.361 |
## | 0.443 | 0.328 | 0.210 | |
## | 0.197 | 0.133 | 0.032 | |
## --------------------|--------------|--------------|--------------|--------------|
## Column Total | 291 | 265 | 100 | 656 |
## | 0.444 | 0.404 | 0.152 | |
## --------------------|--------------|--------------|--------------|--------------|
##
##
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.