Today we’re going to work through the 2020 American National Election Study (ANES) data. ANES has conducted a survey of people before and after each presidential election since 1948. While some questions have remained the same over time (e.g., party identification), others have been added and removed over time. Along with the data set, I have provided the ANES’ codebook for their 2020 data.

Question 1

Read in the 2020 ANES data file, and assign it to an R object named ANES2020. How many observations are there? How many variables are there?

Variables = 1772 Observations = 8,280

ANES2020 <- read.csv('ANES2020.csv')

Question 2

Variable V202331x is a post-election question asking respondents if they favor or oppose requiring vaccines in schools. Consulting the codebook to understand what each value means, create a frequency table and a histogram describing the distribution of responses to this question. (NOTE: I am including a little bit of code here to remove all responses that are essentially NA)

range(ANES2020$V202331x)
## [1] -7  7
ANES2020$V202331x <- ifelse(ANES2020$V202331x<1, NA, ANES2020$V202331x)
table(ANES2020$V202331x)
## 
##    1    2    3    4    5    6    7 
## 4160 1169  173 1145  107  230  400
hist(ANES2020$V202331x, col = "brown")

frequency(ANES2020$V202331x)
## [1] 1

Based on the frequency table and histogram, does it seem like the American public favors or opposes vaccine mandates in school?

Based on the histogram and frequency table the American public strongly favors vaccine mandates.

Question 3

Variable V201151 is a pre-election “feeling thermometer” asking respondents how coldly/warmly they feel towards Joe Biden. For this variable, make a density plot and find:

range(ANES2020$V201151)
## [1]  -9 998
ANES2020$V201151 <- ifelse(ANES2020$V201151 < 0|ANES2020$V201151 > 100, NA, ANES2020$V201151)

plot(density(ANES2020$V201151, na.rm = T))

mean(ANES2020$V201151, na.rm = T)
## [1] 49.23747
median(ANES2020$V201151, na.rm = T)
## [1] 55
sort(table(ANES2020$V201151), decreasing = T) [1]
##    0 
## 1634
var(ANES2020$V201151, na.rm = T)
## [1] 1190.024
skewness(ANES2020$V201151, na.rm = T)
## [1] -0.1559852
## attr(,"method")
## [1] "moment"
kurtosis(ANES2020$V201151, na.rm = T)
## [1] -1.351862
## attr(,"method")
## [1] "excess"
quantile(ANES2020$V201151, na.rm = T)
##   0%  25%  50%  75% 100% 
##    0   15   55   85  100
max(ANES2020$V201151, na.rm = T)
## [1] 100
min(ANES2020$V201151, na.rm = T)
## [1] 0

Question 4

Variable V201152 is a pre-election “feeling thermometer” asking respondents how coldly/warmly they feel towards Donald Trump. For this variable, make a density plot and find:

range(ANES2020$V201152)
## [1]  -9 100
ANES2020$V201152 <- ifelse(ANES2020$V201152 < 0, NA, ANES2020$V201152)

plot(density(ANES2020$V201152, na.rm = T))

mean(ANES2020$V201152, na.rm = T)
## [1] 40.44061
median(ANES2020$V201152, na.rm = T)
## [1] 30
sort(table(ANES2020$V201152), decreasing = T) [1]
##    0 
## 3189
var(ANES2020$V201152, na.rm = T)
## [1] 1624.97
skewness(ANES2020$V201152, na.rm = T)
## [1] 0.29518
## attr(,"method")
## [1] "moment"
kurtosis(ANES2020$V201152, na.rm = T)
## [1] -1.605662
## attr(,"method")
## [1] "excess"
quantile(ANES2020$V201152, na.rm = T)
##   0%  25%  50%  75% 100% 
##    0    0   30   85  100
max(ANES2020$V201152, na.rm = T)
## [1] 100
min(ANES2020$V201152, na.rm = T)
## [1] 0

Question 5

Based on your answers from Questions 3 and 4, how do the distributions of feeling thermometers for Joe Biden and Donald Trump compare? Are the shapes of the distributions similar or different? Which candidate did respondents feel warmer towards?

Based on the distributions of both graphs it becomes apparent that both Trump and Biden have populations that have strong disapproval of their presidencies. Biden’s distribution fluctuates between likeness more throughout the graph, while Trump’s remains consistently low, until the upper quartile where Trump’s approval momentarily increases. Overall Biden has a much warmer response from respondents with fairly moderate approval ratings throughout the distribution. On the other hand, Trump has widely lower approval ratings comparatively to Biden.

Question 6

Variable V201156 is a pre-election “feeling thermometer” asking respondents how coldly/warmly they feel towards the Democratic Party. For this variable, make a density plot and find:

range(ANES2020$V201156)
## [1]  -9 998
ANES2020$V201156 <- ifelse(ANES2020$V201156 < 0|ANES2020$V201156 > 100, NA, ANES2020$V201156)

plot(density(ANES2020$V201156, na.rm = T))

mean(ANES2020$V201156, na.rm = T)
## [1] 45.34948
median(ANES2020$V201156, na.rm = T)
## [1] 50
sort(table(ANES2020$V201156), decreasing = T) [1]
##    0 
## 1663
var(ANES2020$V201156, na.rm = T)
## [1] 1044.648
skewness(ANES2020$V201156, na.rm = T)
## [1] -0.08171164
## attr(,"method")
## [1] "moment"
kurtosis(ANES2020$V201156, na.rm = T)
## [1] -1.280311
## attr(,"method")
## [1] "excess"
quantile(ANES2020$V201156, na.rm = T)
##   0%  25%  50%  75% 100% 
##    0   15   50   70  100
max(ANES2020$V201156, na.rm = T)
## [1] 100
min(ANES2020$V201156, na.rm = T)
## [1] 0

Question 7

Variable V201157 is a pre-election “feeling thermometer” asking respondents how coldly/warmly they feel towards the Republican Party. For this variable, make a density plot and find:

range(ANES2020$V201157)
## [1]  -9 998
ANES2020$V201157 <- ifelse(ANES2020$V201157 < 0|ANES2020$V201157 > 100, NA, ANES2020$V201157)

plot(density(ANES2020$V201157, na.rm = T))

mean(ANES2020$V201157, na.rm = T)
## [1] 43.77447
median(ANES2020$V201157, na.rm = T)
## [1] 50
sort(table(ANES2020$V201157), decreasing = T) [1]
##    0 
## 1562
var(ANES2020$V201157, na.rm = T)
## [1] 1058.824
skewness(ANES2020$V201157, na.rm = T)
## [1] 0.09994281
## attr(,"method")
## [1] "moment"
kurtosis(ANES2020$V201157, na.rm = T)
## [1] -1.244166
## attr(,"method")
## [1] "excess"
quantile(ANES2020$V201157, na.rm = T)
##   0%  25%  50%  75% 100% 
##    0   15   50   70  100
max(ANES2020$V201157, na.rm = T)
## [1] 100
min(ANES2020$V201157, na.rm = T)
## [1] 0

Question 8

Based on your answers from Questions 6 and 7, how do the distributions of feeling thermometers for the Democratic and Republican Parties compare? Are the shapes of the distributions similar or different? Which party did respondents feel warmer towards?

The distributions between both the democratic and republican parties are much more similar. Compared to the respective presidents, the party approval ratings were pretty consistent along partisan lines. It is important to note there is slight variation between the two tables as the democratic party remains relatively higher with more prominent spikes or ‘approval’ visible in the graph. With these observations I can conclude the respondents felt partially warmer towards the democratic party.

Question 9

Compare the comparisons you made in Questions 5 and 8 (we’re getting meta here). Do the differences/similarities with respect to how the sample of respondents felt about the two presidential candidates seem similar or different to how they felt about the two major political parties? Why do you think this might be the case (substantively)?

Respondents across party lines seem to have general loyalty towards their respective parties. The graph of approval ratings displays this fairly well, as both the graphs for democratic and republican approval ratings were, for the most part, symmetrical. However, the individual approval ratings of each candidate did not entirely match their respective parties. Biden had an overall better approval rating, however, this differentiation of the two graphs demonstrates that Americans tend to have more loyalty towards their parties then their party leaders.