Aggregated Polling to Increase Certainty

Ahead of the 2012 election, most polls were favoring Obama very slightly, but they were also all well within the margin of error indicating that Obama was not statistically likely to win, and the poll results may be due to random chance. However, political statistician Nate Silver. confidently stated that he believed Obama would win the election and that his claims were statistically backed by the same polls that were inconclusive. We will examine Silver’s methods and how he came to his conclusions.

url <- 'https://en.wikipedia.org/wiki/Nationwide_opinion_polling_for_the_2012_United_States_presidential_election#Two-way_race'
xpath <- '//*[@id="mw-content-text"]/div[1]/table[2]'

table <- url %>% read_html() %>% html_nodes(xpath = xpath) %>% html_table(fill = T)

table <- table[[1]]
table <- table[2:nrow(table),]
knitr::kable(table)
Poll source Date Barack Obama.mw-parser-output .nobold{font-weight:normal}Democratic Mitt RomneyRepublican Leading by % Sample Size* Margin of Error (MoE)
2 Rasmussen Tracking November 2–4, 2012 48% 49% 1 1,500 LV ±3.0
3 CNN/Opinion Research November 2–4, 2012 50% 48% 2 918 RV ±3%
4 CNN/Opinion Research November 2–4, 2012 49% 49% Tie 693 LV ±3.5%
5 Gallup Tracking November 1–4, 2012 49% 46% 3 2,854 RV ±2%
6 Gallup Tracking November 1–4, 2012 49% 50% 1 2,551 LV ±2%
7 Democracy Corps November 1–4, 2012 49% 45% 4 1,080 LV ±3.0%
8 Ipsos/Reuters October 31–November 4, 2012 48% 42% 6 5,158 RV ±3.0%
9 Ipsos/Reuters October 31–November 4, 2012 48% 47% 1 3,805 LV ±3.4%
10 Angus Reid Public Opinion[permanent dead link] November 1–3, 2012 51% 48% 3 1,050 LV ±3.1%
11 PPP/Americans United for Change November 1–3, 2012 50% 47% 3 1,200 LV ±2.8%
12 NBC News/Wall Street Journal November 1–3, 2012 48% 47% 1 1,475 LV ±2.6%
13 Rasmussen Tracking November 1–3, 2012 49% 49% Tie 3,000(?) LV ±2.5%
14 Pew Research October 31–November 3, 2012 49% 42% 7 3,151 RV ±2.0%
15 Pew Research October 31–November 3, 2012 48% 45% 3 2,709 LV ±2.2%
16 YouGov October 31–November 3, 2012 49% 47% 2 36,472 LV ?
17 ABC News/Washington Post October 31–November 3, 2012 49% 48% 1 2,069 LV ±2.5%
18 PPP/Americans United for Change October 30– November 1, 2012 49% 48% 1 1,200 LV ±2.8%
19 Politico/George Washington University/Battleground October 29–November 1, 2012 48% 49% 1 1,000 LV ±3.1%
20 Washington Times/JZ Analytics October 29–31, 2012 49% 49% Tie 800 LV ±3.5%
21 ABC News/Wash Post October 28–31, 2012 49% 48% 1 1,293 LV ±3%
22 UPI/CVOTER October 15–31, 2012 49% 48% 1 3,633 LV ±3.5% (?)
23 Fox News October 28–30, 2012 46% 45% 1 1,230 RV ±3%
24 Fox News October 28–30, 2012 46% 46% Tie 1,128 LV ±3%
25 JZAnalytics October 28–30, 2012 45% 48% 3 1,015 LV ±3.1%
26 High Point University October 22–30, 2012 46% 43% 3 805 RV ±3.5%
27 Rasmussen Tracking October 27–29, 2012 47% 49% 2 1,500 LV ±3.0%
28 YouGov/The Economist October 26–28, 2012 48% 46% 2 757 RV ±4.6%
29 YouGov/The Economist October 26–28, 2012 48% 47% 1 688 LV ±4.6%
30 United Technologies/National Journal October 25–28, 2012 50% 45% 5 713 LV ±4.4%
31 CBS News/New York Times October 25–28, 2012 48% 47% 1 563 LV ±4.0%
32 ABC News/Washington Post October 25–28, 2012 49% 49% Tie 1,259 LV ±3.5%
33 DailyKos/PPP/SEIU October 25–28, 2012 49% 49% Tie 1,400 LV ±2.6%
34 Pew Research October 24–28, 2012 47% 45% 2 1,678 RV ±2.8%
35 Pew Research October 24–28, 2012 47% 47% Tie 1,495 LV ±2.9%
36 Ipsos/Reuters October 24–28, 2012 51% 39% 12 1,133 RV ±3.3%
37 Ipsos/Reuters October 24–28, 2012 49% 46% 3 795 LV ±4.0%
38 Gallup Tracking October 22–28, 2012 48% 48% Tie 3,050 RV ±2%
39 Gallup Tracking October 22–28, 2012 46% 51% 5 2,700 LV ±2%
40 Investor’s Business Daily/TIPP October 22–27, 2012 45% 44% 1 942 LV ±3.5%
41 National Public Radio October 23–25, 2012 47% 48% 1 1,000 LV ±3.1%
42 Politico/George Washington University/Battleground October 22–25, 2012 49% 48% 1 1,000 LV ±3.1%
43 PPP/Americans United for Change October 22–24, 2012 49% 48% 1 1,200 LV ±2.8%
44 ABC News/Washington Post October 21–24, 2012 47% 50% 3 1,386 LV ±3.0%
45 Associated Press/GFK October 19–23, 2012 48% 40% 8 1,186 adults ±3.5%
46 Associated Press/GFK October 19–23, 2012 45% 44% 1 1,041 RV ±3.5%
47 Associated Press/GFK October 19–23, 2012 45% 47% 2 839 LV ±4.2%
48 IBD/TIPP October 17–22, 2012 47% 45% 2 938 LV ±3.5%
49 Rasmussen Tracking October 20–22, 2012 46% 50% 4 1,500 LV ±3%
50 ABC News/Wash Post October 18–21, 2012 49% 48% 1 1,376 LV ±3%
51 Monmouth/SurveyUSA/Braun October 18–21, 2012 45% 48% 3 1,402 LV ±2.6%
52 Gallup Tracking October 14–20, 2012 45% 52% 7 2,700 LV ±2%
53 Gallup Tracking October 14–20, 2012 46% 49% 3 3,050 RV ±2%
54 Washington Times/JZ Analytics October 18–20, 2012 50% 47% 3 800 LV ±3.5%
55 CBS News October 17–20, 2012 48% 46% 2 790 LV ±4%
56 NBC News/Wall Street Journal October 17–20, 2012 47% 47% Tie 816 LV ±3.4%
57 NBC News/Wall Street Journal October 17–20, 2012 49% 44% 5 1,000 RV ±3.1%
58 PPP/Americans United for Change October 17–19, 2012 49% 47% 2 1,200 LV ±2.8%
59 Politico/George Washington University/Battleground October 15–18, 2012 47% 49% 2 1,000 LV ±3.1%
60 UConn/Hartford Courant October 11–16, 2012 48% 45% 3 1,023 LV ±3%
61 Rasmussen Reports October 13–15, 2012 47% 49% 2 1,500 LV ±3.0%
62 IBD/TIPP Tracking October 10–15, 2012 47% 45% 2 931 LV ±3.5%
63 Gallup Tracking October 9–15, 2012 46% 50% 4 2,700 LV ±2.0%
64 Washington Post-ABC News October 10–13, 2012 49% 46% 3 923 LV ±3.5%
65 Washington Post-ABC News October 10–13, 2012 50% 43 7 1,063 RV ±3.5%
66 Angus Reid Public Opinion[permanent dead link] October 10–11, 2012 47% 47% Tie 906 RV ±3.5%
67 Politico/George Washington University/Battleground October 7–11, 2012 49% 48% 1 1,000 LV ±3.1%
68 Reuters/Ipsos October 7–11, 2012 44% 47% 3 1,092 LV ±3.4%
69 Fox News October 7–9, 2012 46% 44% 2 1,204 RV ±3%
70 Fox News October 7–9, 2012 45% 46% 1 1,109 LV ±3%
71 Zogby / JZAnalytics October 5–7, 2012 45% 45% Tie 800 LV ±3.5%
72 Investor’s Business Daily/TIPP October 4–9, 2012 46% 47% 1 812 LV ±3.5%
73 Pew Research Center October 4–7, 2012 46% 46% Tie 1,201 RV ±3.3%
74 Pew Research Center October 4–7, 2012 45% 49% 4 1,112 LV ±3.4%
75 Gallup Tracking October 4–6, 2012 47% 47% Tie 1,387 RV ±3.0%
76 PPP/Daily Kos & SEIU October 4–7, 2012 47% 49% 2 1,300 LV ±2.7%
77 Rasmussen Reports October 4–7, 2012 47% 49% 2 1,500 LV ±3.0%
78 CNN/Opinion Research September 28–30, 2012 50% 46% 4 883 RV ±3.5%
79 CNN/Opinion Research September 28–30, 2012 50% 47% 3 783 LV ±3.5%
80 PPP/Daily Kos & SEIU September 27–30, 2012 49% 45% 4 1,100 LV ±2.8%
81 47% 47% Tie 1,005 LV ±3.7%
82 NBC/Wall Street Journal September 26–30, 2012 51% 44% 7 1,000 RV ±3.10%
83 NBC/Wall Street Journal September 26–30, 2012 49% 46% 3 832 LV ±3.40%
84 Quinnipiac University September 25–30, 2012 49% 45% 4 1,912 LV ±2.2%
85 ABC News/Wash Post September 26–29, 2012 49% 44% 5 929 RV ±3.5%
86 ABC News/Wash Post September 26–29, 2012 49% 47% 2 813 LV ±4%
87 Politico/George Washington University/Battleground September 24–27, 2012 50% 47% 3 1,000 LV ±3.1%
88 Fox News September 26–29, 2012 49% 41% 8 1,208 RV ±3%
89 Fox News September 26–29, 2012 48% 43% 5 1,092 LV ±3%
90 Rasmussen Tracking September 23–25, 2012 46% 46% Tie 1,500 LV ±3.0%
91 Gallup Tracking September 19–25, 2012 50% 44% 6 3,050 RV ±2.0%
92 Bloomberg September 21–24, 2012 49% 43% 6 789 LV ±3.5%
93 Reuters/Ipsos September 20–24, 2012 49% 43% 6 1,313 RV ±3.1%
94 PPP/Daily Kos & SEIU September 20–23, 2012 50% 45% 5 1,200 LV ±2.8%
95 Zogby / JZAnalytics September 21–22, 2012 49% 41% 8 860 LV ±3.4%
96 Politico/George Washington University September 16–20, 2012 50% 46% 4 1,000 LV ±3.1%
97 Angus Reid Public Opinion[permanent dead link] September 19–20, 2012 48% 46% 2 865 RV ±3.5%
98 Allstate/National Journal September 15–19, 2012 50% 43% 7 1,055 LV ±3%
99 UConn/Hartford Courant September 11–18, 2012 46% 43% 3 1,148 LV ±3%
100 Reason-Rupe September 13–17, 2012 52% 45% 7 787 LV ±4.3%
101 Associated Press/GfK Roper September 13–17, 2012 52% 37% 15 1,512 adults ±3.2%
102 Associated Press/GfK Roper September 13–17, 2012 50% 40% 10 1,282 RV ±3.4%
103 Associated Press/GfK Roper September 13–17, 2012 47% 46% 1 807 LV ±4.3%
104 Ipsos/Reuters September 12–17, 2012 46% 41% 5 737 RV ±4.1%
105 Ipsos/Reuters September 12–17, 2012 48% 43% 5 591 LV ±4.1%
106 Monmouth University September 13–16, 2012 48% 41% 7 1,571 RV ±2.5%
107 Monmouth University September 13–16, 2012 48% 45% 3 1,344 LV ±2.5%
108 Pew Research Center September 12–16, 2012 51% 42% 9 2,424 RV ±2.3%
109 Pew Research Center September 12–16, 2012 51% 43% 8 2,192 LV ±2.4%
110 NBC/Wall Street Journal September 12–16, 2012 50% 44% 6 900 RV ±3.27%
111 NBC/Wall Street Journal September 12–16, 2012 50% 45% 5 736 LV ±3.61%
112 Zogby / JZAnalytics September 11–12, 2012 47.7% 42% 5.7 1,014 LV ±3.1%
113 UPI/CVOTER September 8–14, 2012 49% 45% 4 3,000 LV ±3%
114 CBS/New York Times September 8–12, 2012 51% 43% 8 1,170 RV ±3%
115 CBS/New York Times September 8–12, 2012 49% 46% 3 1,162 LV ±3%
116 Democracy Corps September 8–12, 2012 50% 45% 5 1,000 LV ±3.1%
117 Fox News September 9–11, 2012 46% 42% 4 1,224 RV ±3%
118 Fox News September 9–11, 2012 48% 43% 5 1,056 LV ±3%
119 Rasmussen Tracking September 8–11, 2012 46% 45% 1 1,500 LV ±3.0%
120 Gallup Tracking September 6–12, 2012 50% 44% 6 3,050 RV ±2.0%
121 YouGov/The Economist September 8–10, 2012 49% 45% 4 ≤1,000 RV ±3.9%
122 Esquire/Yahoo! News September 7–10, 2012 52% 41% 11 ≤1,002 RV ±4.5%
123 Esquire/Yahoo! News September 7–10, 2012 50% 46% 4 ≤1,002 LV ±5%
124 Daily Kos/PPP September 7–9, 2012 50% 44% 6 1,000 LV ±3.1%
125 ABC/Washington Post September 7–9, 2012 50% 44% 6 826 RV ±4%
126 ABC/Washington Post September 7–9, 2012 49% 48% 1 710 LV ±4.5%
127 CNN/Opinion Research September 7–9, 2012 53% 45% 8 875 RV ±3.5%
128 CNN/Opinion Research September 7–9, 2012 52% 46% 6 709 LV ±3.5%
129 Ipsos/Reuters Tracking September 6–10, 2012 45% 41% 4 1,434 RV ±3.0%
130 Ipsos/Reuters Tracking September 6–10, 2012 48% 43% 5 1,182 LV ±3.0%

Above we see a list of polls conducted, and we see how although Obama leads most of the polls leading up to the election, his lead is slight and usually within the margin of error. However, Nate Silver cleverly used aggregate polling, a method that involves combining many polls and treating them as one poll, to improve the certainty of his prediction. The increased sample size led to a smaller margin of error and a more confident prediction.

names(table)[3] <- 'Obama'
names(table)[4] <- 'Romney'
names(table)[6] <- 'Sample_Size'

clean_table <- table[3:ncol(table)] %>% apply(2, str_replace_all, 'Tie', '0') %>% apply(2, str_replace_all, '[^(0-9\\.)]', '') %>% as.data.frame() %>% mutate(Obama_prop = as.numeric(as.character(Obama))/100) %>% mutate(Romney_prop = as.numeric(as.character(Romney))/100) %>% mutate(Obama_num = Obama_prop * as.numeric(as.character(Sample_Size))) %>% mutate(Romney_num = Romney_prop * as.numeric(as.character(Sample_Size)))
## Warning: NAs introduced by coercion

## Warning: NAs introduced by coercion
knitr::kable(clean_table)
Obama Romney Leading by % Sample_Size Margin of Error (MoE) Obama_prop Romney_prop Obama_num Romney_num
48 49 1 1500 3.0 0.480 0.49 720.000 735.00
50 48 2 918 3 0.500 0.48 459.000 440.64
49 49 0 693 3.5 0.490 0.49 339.570 339.57
49 46 3 2854 2 0.490 0.46 1398.460 1312.84
49 50 1 2551 2 0.490 0.50 1249.990 1275.50
49 45 4 1080 3.0 0.490 0.45 529.200 486.00
48 42 6 5158 3.0 0.480 0.42 2475.840 2166.36
48 47 1 3805 3.4 0.480 0.47 1826.400 1788.35
51 48 3 1050 3.1 0.510 0.48 535.500 504.00
50 47 3 1200 2.8 0.500 0.47 600.000 564.00
48 47 1 1475 2.6 0.480 0.47 708.000 693.25
49 49 0 3000() 2.5 0.490 0.49 NA NA
49 42 7 3151 2.0 0.490 0.42 1543.990 1323.42
48 45 3 2709 2.2 0.480 0.45 1300.320 1219.05
49 47 2 36472 0.490 0.47 17871.280 17141.84
49 48 1 2069 2.5 0.490 0.48 1013.810 993.12
49 48 1 1200 2.8 0.490 0.48 588.000 576.00
48 49 1 1000 3.1 0.480 0.49 480.000 490.00
49 49 0 800 3.5 0.490 0.49 392.000 392.00
49 48 1 1293 3 0.490 0.48 633.570 620.64
49 48 1 3633 3.5() 0.490 0.48 1780.170 1743.84
46 45 1 1230 3 0.460 0.45 565.800 553.50
46 46 0 1128 3 0.460 0.46 518.880 518.88
45 48 3 1015 3.1 0.450 0.48 456.750 487.20
46 43 3 805 3.5 0.460 0.43 370.300 346.15
47 49 2 1500 3.0 0.470 0.49 705.000 735.00
48 46 2 757 4.6 0.480 0.46 363.360 348.22
48 47 1 688 4.6 0.480 0.47 330.240 323.36
50 45 5 713 4.4 0.500 0.45 356.500 320.85
48 47 1 563 4.0 0.480 0.47 270.240 264.61
49 49 0 1259 3.5 0.490 0.49 616.910 616.91
49 49 0 1400 2.6 0.490 0.49 686.000 686.00
47 45 2 1678 2.8 0.470 0.45 788.660 755.10
47 47 0 1495 2.9 0.470 0.47 702.650 702.65
51 39 12 1133 3.3 0.510 0.39 577.830 441.87
49 46 3 795 4.0 0.490 0.46 389.550 365.70
48 48 0 3050 2 0.480 0.48 1464.000 1464.00
46 51 5 2700 2 0.460 0.51 1242.000 1377.00
45 44 1 942 3.5 0.450 0.44 423.900 414.48
47 48 1 1000 3.1 0.470 0.48 470.000 480.00
49 48 1 1000 3.1 0.490 0.48 490.000 480.00
49 48 1 1200 2.8 0.490 0.48 588.000 576.00
47 50 3 1386 3.0 0.470 0.50 651.420 693.00
48 40 8 1186 3.5 0.480 0.40 569.280 474.40
45 44 1 1041 3.5 0.450 0.44 468.450 458.04
45 47 2 839 4.2 0.450 0.47 377.550 394.33
47 45 2 938 3.5 0.470 0.45 440.860 422.10
46 50 4 1500 3 0.460 0.50 690.000 750.00
49 48 1 1376 3 0.490 0.48 674.240 660.48
45 48 3 1402 2.6 0.450 0.48 630.900 672.96
45 52 7 2700 2 0.450 0.52 1215.000 1404.00
46 49 3 3050 2 0.460 0.49 1403.000 1494.50
50 47 3 800 3.5 0.500 0.47 400.000 376.00
48 46 2 790 4 0.480 0.46 379.200 363.40
47 47 0 816 3.4 0.470 0.47 383.520 383.52
49 44 5 1000 3.1 0.490 0.44 490.000 440.00
49 47 2 1200 2.8 0.490 0.47 588.000 564.00
47 49 2 1000 3.1 0.470 0.49 470.000 490.00
48 45 3 1023 3 0.480 0.45 491.040 460.35
47 49 2 1500 3.0 0.470 0.49 705.000 735.00
47 45 2 931 3.5 0.470 0.45 437.570 418.95
46 50 4 2700 2.0 0.460 0.50 1242.000 1350.00
49 46 3 923 3.5 0.490 0.46 452.270 424.58
50 43 7 1063 3.5 0.500 0.43 531.500 457.09
47 47 0 906 3.5 0.470 0.47 425.820 425.82
49 48 1 1000 3.1 0.490 0.48 490.000 480.00
44 47 3 1092 3.4 0.440 0.47 480.480 513.24
46 44 2 1204 3 0.460 0.44 553.840 529.76
45 46 1 1109 3 0.450 0.46 499.050 510.14
45 45 0 800 3.5 0.450 0.45 360.000 360.00
46 47 1 812 3.5 0.460 0.47 373.520 381.64
46 46 0 1201 3.3 0.460 0.46 552.460 552.46
45 49 4 1112 3.4 0.450 0.49 500.400 544.88
47 47 0 1387 3.0 0.470 0.47 651.890 651.89
47 49 2 1300 2.7 0.470 0.49 611.000 637.00
47 49 2 1500 3.0 0.470 0.49 705.000 735.00
50 46 4 883 3.5 0.500 0.46 441.500 406.18
50 47 3 783 3.5 0.500 0.47 391.500 368.01
49 45 4 1100 2.8 0.490 0.45 539.000 495.00
47 47 0 1005 3.7 0.470 0.47 472.350 472.35
51 44 7 1000 3.10 0.510 0.44 510.000 440.00
49 46 3 832 3.40 0.490 0.46 407.680 382.72
49 45 4 1912 2.2 0.490 0.45 936.880 860.40
49 44 5 929 3.5 0.490 0.44 455.210 408.76
49 47 2 813 4 0.490 0.47 398.370 382.11
50 47 3 1000 3.1 0.500 0.47 500.000 470.00
49 41 8 1208 3 0.490 0.41 591.920 495.28
48 43 5 1092 3 0.480 0.43 524.160 469.56
46 46 0 1500 3.0 0.460 0.46 690.000 690.00
50 44 6 3050 2.0 0.500 0.44 1525.000 1342.00
49 43 6 789 3.5 0.490 0.43 386.610 339.27
49 43 6 1313 3.1 0.490 0.43 643.370 564.59
50 45 5 1200 2.8 0.500 0.45 600.000 540.00
49 41 8 860 3.4 0.490 0.41 421.400 352.60
50 46 4 1000 3.1 0.500 0.46 500.000 460.00
48 46 2 865 3.5 0.480 0.46 415.200 397.90
50 43 7 1055 3 0.500 0.43 527.500 453.65
46 43 3 1148 3 0.460 0.43 528.080 493.64
52 45 7 787 4.3 0.520 0.45 409.240 354.15
52 37 15 1512 3.2 0.520 0.37 786.240 559.44
50 40 10 1282 3.4 0.500 0.40 641.000 512.80
47 46 1 807 4.3 0.470 0.46 379.290 371.22
46 41 5 737 4.1 0.460 0.41 339.020 302.17
48 43 5 591 4.1 0.480 0.43 283.680 254.13
48 41 7 1571 2.5 0.480 0.41 754.080 644.11
48 45 3 1344 2.5 0.480 0.45 645.120 604.80
51 42 9 2424 2.3 0.510 0.42 1236.240 1018.08
51 43 8 2192 2.4 0.510 0.43 1117.920 942.56
50 44 6 900 3.27 0.500 0.44 450.000 396.00
50 45 5 736 3.61 0.500 0.45 368.000 331.20
47.7 42 5.7 1014 3.1 0.477 0.42 483.678 425.88
49 45 4 3000 3 0.490 0.45 1470.000 1350.00
51 43 8 1170 3 0.510 0.43 596.700 503.10
49 46 3 1162 3 0.490 0.46 569.380 534.52
50 45 5 1000 3.1 0.500 0.45 500.000 450.00
46 42 4 1224 3 0.460 0.42 563.040 514.08
48 43 5 1056 3 0.480 0.43 506.880 454.08
46 45 1 1500 3.0 0.460 0.45 690.000 675.00
50 44 6 3050 2.0 0.500 0.44 1525.000 1342.00
49 45 4 1000 3.9 0.490 0.45 490.000 450.00
52 41 11 1002 4.5 0.520 0.41 521.040 410.82
50 46 4 1002 5 0.500 0.46 501.000 460.92
50 44 6 1000 3.1 0.500 0.44 500.000 440.00
50 44 6 826 4 0.500 0.44 413.000 363.44
49 48 1 710 4.5 0.490 0.48 347.900 340.80
53 45 8 875 3.5 0.530 0.45 463.750 393.75
52 46 6 709 3.5 0.520 0.46 368.680 326.14
45 41 4 1434 3.0 0.450 0.41 645.300 587.94
48 43 5 1182 3.0 0.480 0.43 567.360 508.26

Given that for each poll we know the proportion of voters for a given candidate and the sample size, we can deduce the number of voters for each candidate and create an aggregate poll containing all voters.

clean_table$Sample_Size <- as.numeric(as.character(clean_table$Sample_Size))
## Warning: NAs introduced by coercion
obama_voters = round(sum(clean_table$Obama_num, na.rm = T))
romney_voters = round(sum(clean_table$Romney_num, na.rm = T))
all_voters = sum(clean_table$Sample_Size, na.rm = T)

obama_prop = obama_voters/all_voters
romney_prop = romney_voters/all_voters
print(c(obama_prop, romney_prop))
## [1] 0.4834197 0.4599031

We see that in the aggregate poll, Obama captures 48% of the voters and Romney captures 46%, similar to many of the other polls. The strength of using an aggregate poll however is that the certainty of the estimate is much stronger due to the larger sample size. We can calculate the margin of error as 2 * 1.96 * sqrt(p(1-p)/n)

moe = 2 * 1.96 * sqrt(obama_prop*(1-obama_prop)/all_voters)
print(moe)
## [1] 0.004301585

We see that due to the large sample size, the margin of error for the spread between Obama and Romney is .4%, well below the actual spread of approximately 2.4%. This margin of error is likely overconfident as it fails to account for various sampling biases that are often present in election polling, but it allowed Silver to make confident predictions with a statistical basis.