Problem set 1

1. Load the data into R and check the dimensions of the data. Also, obtain a summary of the data.

data(turnout, package = "qss")
dim(turnout)
[1] 14  9
summary(turnout)
      year           VEP              VAP             total       
 Min.   :1980   Min.   :159635   Min.   :164445   Min.   : 64991  
 1st Qu.:1986   1st Qu.:171192   1st Qu.:178930   1st Qu.: 73179  
 Median :1993   Median :181140   Median :193018   Median : 89055  
 Mean   :1993   Mean   :182640   Mean   :194226   Mean   : 89778  
 3rd Qu.:2000   3rd Qu.:193353   3rd Qu.:209296   3rd Qu.:102370  
 Max.   :2008   Max.   :213314   Max.   :230872   Max.   :131304  
                                                                  
      ANES           felons         noncit         overseas       osvoters  
 Min.   :47.00   Min.   : 802   Min.   : 5756   Min.   :1803   Min.   :263  
 1st Qu.:57.00   1st Qu.:1424   1st Qu.: 8592   1st Qu.:2236   1st Qu.:263  
 Median :70.50   Median :2312   Median :11972   Median :2458   Median :263  
 Mean   :65.79   Mean   :2177   Mean   :12229   Mean   :2746   Mean   :263  
 3rd Qu.:73.75   3rd Qu.:3042   3rd Qu.:15910   3rd Qu.:2937   3rd Qu.:263  
 Max.   :78.00   Max.   :3168   Max.   :19392   Max.   :4972   Max.   :263  
                                                               NA's   :13   
(continued) How many observations are there?

14 observations *9(var).

What is the range of years covered in this data set?

As shown below, the range of years is 1980, 2008.

range(turnout$year)
[1] 1980 2008

2. Calculate the turnout rate based on the voting age population or VAP.

turnout[is.na(turnout)] = 0
turnout.rate <-function(a,b,c,d){
  results=(a+b)/(c+d)
  return(results*100)
}
VAP.turnout.rate <- turnout.rate(turnout$total,turnout$osvoters,turnout$VAP,turnout$overseas)
VAP.turnout.rate
 [1] 52.03972 40.24522 52.53748 36.07845 49.72260 35.93884 54.04097 38.03086
 [9] 47.53376 34.83169 49.34211 35.82850 54.54777 55.78560

Next, calculate the turnout rate using VEP.

VEP.turnout.rate <- turnout.rate(turnout$total,turnout$osvoters,turnout$VEP,turnout$overseas)
VEP.turnout.rate
 [1] 53.59023 41.62291 54.48157 37.65150 52.09115 37.84916 57.34207 40.63034
 [9] 50.97434 37.51455 53.41718 38.86261 58.98141 60.27276
What difference do you observe?
the turnout rates calculated using VAP are higher than VEP.

3. Compute the difference between the VAP and ANES estimates of turnout rate.

Df <- turnout$ANES - VAP.turnout.rate
Df
 [1] 18.96028 19.75478 21.46252 16.92155 20.27740 11.06116 20.95903 17.96914
 [9] 25.46624 17.16831 23.65789 26.17150 22.45223 22.21440

How big is the difference on average?

mean(Df)
[1] 20.32117

What is the range of the differences?

range(Df)
[1] 11.06116 26.17150

Conduct the same comparison for the VEP and ANES:

Df2 <- turnout$ANES - VEP.turnout.rate
Df2
 [1] 17.409767 18.377091 19.518426 15.348504 17.908847  9.150841 17.657930
 [8] 15.369658 22.025661 14.485454 19.582821 23.137389 18.018592 17.727239
mean(Df2)
[1] 17.5513
range(Df2)
[1]  9.150841 23.137389

On average, the difference between VAP and ANES is bigger than that between VEP and ANES. Also, the VAP and ANES has a broader range in their difference.

4. Compare the VEP turnout rate with the ANES turnout rate separately for presidential elections and midterm elections.

Presidential Elections:

Pre_elc <- turnout$ANES[c(1, 3 ,5 ,7 ,9 ,11, 13, 14)]-VEP.turnout.rate[c(1, 3 ,5 ,7 ,9 ,11, 13, 14)]
Pre_elc
[1] 17.40977 19.51843 17.90885 17.65793 22.02566 19.58282 18.01859 17.72724
mean(Pre_elc)
[1] 18.73116
range(Pre_elc)
[1] 17.40977 22.02566

Midterm Elections:

Mid_elc <- turnout$ANES[c(2,4,6,8,10,12)]-VEP.turnout.rate[c(2,4,6,8,10,12)]
Mid_elc
[1] 18.377091 15.348504  9.150841 15.369658 14.485454 23.137389
mean(Mid_elc)
[1] 15.97816
range(Mid_elc)
[1]  9.150841 23.137389

Does the bias of the ANES estimates vary across election types? Yes. The bias of the ANES seems greater in the presidential election.

5. Divide the data into half by election years such that you subset the data into two periods.

Prd1 <- turnout[1:7,]
Prd2 <- turnout[8:14,]
Prd1
  year    VEP    VAP  total ANES felons noncit overseas osvoters
1 1980 159635 164445  86515   71    802   5756     1803        0
2 1982 160467 166028  67616   60    960   6641     1982        0
3 1984 167702 173995  92653   74   1165   7482     2361        0
4 1986 170396 177922  64991   53   1367   8362     2216        0
5 1988 173579 181955  91595   70   1594   9280     2257        0
6 1990 176629 186159  67859   47   1901  10239     2659        0
7 1992 179656 190778 104405   75   2183  11447     2418        0
Prd2
   year    VEP    VAP  total ANES felons noncit overseas osvoters
8  1994 182623 195258  75106   56   2441  12497     2229        0
9  1996 186347 200016  96263   73   2586  13601     2499        0
10 1998 190420 205313  72537   52   2920  14988     2937        0
11 2000 194331 210623 105375   73   3083  16218     2937        0
12 2002 198382 215462  78382   62   3168  17237     3308        0
13 2004 203483 220336 122295   77   3158  18068     3862        0
14 2008 213314 230872 131304   78   3145  19392     4972      263

Calculate the difference between the VEP turnout rate and the ANES turnout rate separately for each year within each period.

Prd1$ANES[1:7] - turnout.rate(Prd1$total,Prd1$osvoters,Prd1$VEP,Prd1$overseas)
[1] 17.409767 18.377091 19.518426 15.348504 17.908847  9.150841 17.657930
Prd2$ANES[1:7] - turnout.rate(Prd2$total,Prd2$osvoters,Prd2$VEP,Prd2$overseas)
[1] 15.36966 22.02566 14.48545 19.58282 23.13739 18.01859 17.72724

Has the bias of ANES increased over time? According to the results below, the difference between the VEP turnout rate and the ANES turnout rate for each period increased on average (16.48163 -> 18.62097). Therefore, it seems that the bias of ANES has increased.

mean(Prd1$ANES[1:7] - turnout.rate(Prd1$total,Prd1$osvoters,Prd1$VEP,Prd1$overseas))
[1] 16.48163
mean(Prd2$ANES[1:7] - turnout.rate(Prd2$total,Prd2$osvoters,Prd2$VEP,Prd2$overseas))
[1] 18.62097

6. ANES does not interview prisoners and overseas voters. Calculate an adjustment to the 2008 VAP rutnout rate. Begin by subtracting the total number of ineligible felons and noncitizens from the VAP to calculate an adjusted VAP. Nest, calculate an adjusted VAP turnout rate, taking care to subtract the number of overseas ballots counted from the total ballots in 2008. Compare the adjusted VAP turnout with the unadjusted VAP, VEP, and the AANES turnout rate. Briefly discuss the results.

Adjusted VAP rate:

adj.VAP.turnout.rate <- ((turnout$total[14] - turnout$osvoters[14])/
(turnout$VAP[14] - turnout$felons[14] - turnout$noncit[14] - turnout$overseas[14]))*100
adj.VAP.turnout.rate
[1] 64.43699

Comparison with unadjusted VAP, VEP, ANES (2008):

adj.VAP.turnout.rate
[1] 64.43699
VAP.turnout.rate[14]
[1] 55.7856
VEP.turnout.rate[14]
[1] 60.27276
turnout$ANES[14]
[1] 78

After adjusting, VAP turnout rate for 2008 increased by 8.65139 and the gap between VAP and ANES turnout rates reduced accordingly. Also, the adjustment resulted in the higher VAP turnout rate than VEP turnout rate.