Application Center - Maplesoft

App Preview:

U.S. Presidential Election Calculator

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application




U.S. Presidential Election Calculator

 

Dr. Joseph F. Kolacinski, Assistant Professor
Elmira College, United States
jkolacinski@elmira.edu

Ashley Culpepper
Elmira College, United States
aculpepper12@elmira.edu

Introduction

 

During 2008, the art of predicting the results of the U.S. Presidential Election became an increasing area of interest. Many websites attempted to track state-by-state polls and project an over all winner.  One website, <www.fivethirtyeight.com>, had a particularly robust election model. The authors of this site combined historical analysis of polling data with regional demographics and numerous statewide polls weighed by the pollster's track record, the poll's sample size and recentness, to project how a state would vote. Using this information, they ran 10,000 election simulations each day to estimate the probability that each candidate would win each state and the overall election. The "U.S. Presidential Election Calculator" was inspired by their work.

 

The purpose of this calculator is to allow a user to enter his or her own polling estimates for each state and then to use these estimates to simulate multiple Presidential Elections. The percentage of victories for each candidate estimates the probabilities that the Democratic candidate or the Republican candidate will win the election.

 

To model a state election, the calculator uses polling information within the state to calculate the probabality that a random voter will vote for either the democratic or the republican candidate.  It then generates 1001 random voters and assigns each to either the Republican or Democratic candidate based on these probabilities. The candidate who receives at least 501 votes is awarded the electoral votes for that state.  Maine and Nebraska award their electoral votes according to the votes within each congressional district but for the sake of simplicity, both Maine and Nebraska are modeled in the calculator as "winner take all" states. The overall election is modeled by running 51 individual state elections, one for each state and the District of Columbia.  The electoral votes are tallied and it is determined if the Democratic or Republican candidiate won the election, or if there was a tie. This individual simulation may be run as many times as the user would like, time permitting, and overall results will be displayed including the probability that each candidate will win the election, the mean electoral vote count for each party, and a few other statistics.  Keep in mind that as the number of individual simulations gets larger, the probabilities get more accurate, but a large number of simulations can take a considerable time to run.

 

 

Poll Numbers

 

You may enter your own polling data here, or you may use the default polling data from the 2008 election. Click on the grey triangle next to "Numbers" to view the data. To read this, AlabamaDemPoll represents the poll number for the state of Alabama for the Democratic candidate, while AlabamaRepPoll represents the poll number for the Republican candidate. The input values should range from 0 to 100. So, for example, if the Democratic candidate is polling at 34.4% in Texas, then TexasDemPoll should be entered as 34.4 and not .344.

 

Please note that the final calculations depend highly on the poll numbers. If inaccurate or biased polling data is used in simulations, the overall result will be inaccurate or biased. At best, the final results will only be as good as the polling information. State by state polling data can be found at the following websites:
http://www.fivethirtyeight.com/
http://www.electoral-vote.com/

http://www.pollingreport.com/


Once you have entered the polling data you would like to use, click anywhere within the section started by the red carrot under "Numbers" and press enter. The poll information will be loaded. You may then close this section by clicking on the grey triangle next to "Poll Numbers."

Numbers

 

 

The default values used in this section were taken from the website < www.fivethirtyeight.com > immediately before the 2008 election.  When this calculator is run with this data and the 2008 configuration of the Electoral College, it generates the probabilities of an Obama or McCain victory as of 3 November 2008.

 

 

Electoral Votes

 

Before an election, you must set the number of electoral votes per state. The ElectoralVotes2000 command below will load the Electoral vote values that were used in the 1992, 1996, and 2000 elections. ElectoralVotes2008 will use the values that were used in the 2004 and 2008 elections. ElectoralVotes2012 will use the values that will be used in the 2012, 2016, and 2020 elections.

 

If you wish to model an earlier election, you may enter your own electoral votes per state under the "Other" tab. Each state is generally designated with its U.S. postal abbreviation. The exceptions are Indiana and Oregon, which we have abbreviated as ind and org, respectively. Please remember that in the U.S. Electoral College, the total number of votes has been 538 since 1964, and the mimumum number of votes per state is 3.  When modeling elections prior to 1964, enter "0" for the Electoral Votes of any state not voting.

Please click on whichever set of electoral votes you would like to use, and hit enter. Do not enter multiple packages. MAPLE will only read the package last entered. Then, you may close this section by clicking on the grey triangle next to "Electoral Votes."

Other

 

 

 

Number of Trials

 

Here, you may change the number of simulated elections that the calculator will run. You may change "10" to any number but please be cautioned. Numbers exceeding 50 may take over ten minutes to compute, and numbers over 300 can take over an hour. These considerations should be balanced against the fact that larger values of "n" should yield more accurate probabilities.

Once you are ready, click anywhere next to the red carrot and press enter. Then, you may close this section by clicking on the grey triangle next to "Number of Trials."

 

 

Calculator

 

Here is the Election Calculator. To run, click anywhere next to the red carrot and press enter. This process, depending upon how many trials were entered will take several minutes to several hours to run.

The results will display the following:
Number of Trials
Democratic candidate's Mimumum electoral votes received
Democratic candidate's Mean electoral votes received
Democratic candidate's Maximum electoral votes received
Republican candidate's Minimum electoral votes received

Republican candidate's Mean electoral votes received

Republican candidate's Maximum electoral votes received
Democratic candidate's Probability of a win

Republican candidate's Probability of a win

The Probability of a tie

 

 

Testing Results

 

When we were testing the calculator, we used the polling results prior to the 2008 Presidential Election (the defaulted poll numbers) using the 2008 electoral vote values. With this information, we ran 1,000 simulations (which took roughly 2 1/2 hours). Below are two of our results:

 

Trial 1:

Electoral Votes

Democratic Minimum = 281

Democratic Mean = 348.997

Democratic Maximum = 403

Republican Minimum = 135

Republican Mean = 189.003

Republican Maximum = 257

 

Win Probability

Democratic win = 1.000

Republican win = 0.000

Tie = 0.000

 

Trial 2:

Electoral Votes

Democratic Minimum = 281

Democratic Mean = 348.15

Democratic Maximum = 396

Republican Minimum = 142

Republican Mean = 189.85

Republican Maximum = 257

 

Win Probability

Democratic win = 1.000

Republican win = 0.000

Tie = 0.000

(5.1.1)

If we look at the actual 2008 Presidential results, we find that the Democrat, Obama, won the election with 365 electoral votes and the Republican, McCain, received 173. These resullts are well within the margin of error for the calculator's output.  In addition, the primary focus of this calculator are the probabilities, which indicate that the Democrat has a 100% chance of winning the Presidential election. In 2008, Nate Silver had generated similar results to the calculator's final result. Using the same data, FiveThirtyEight used their own simulator to generate 10,000 election results. He projected an average of 348.6 electoral votes for Obama and 189.4 electoral votes for McCain, with a win percentage for Obama of 98.9%. Our calculator produced results close to FiveThirtyEight's projection, even with 9,000 fewer repetitions.

 

 

 

Acknowledgements

 

This application was created using Maple 14.  Some of the processes were originally written for "A Presidential Election Game, 2008 Edition", by N. Mercier.  Readers interested in tracking and simulating elections are encouraged to seek out the many good websites on the topic during the next election cycle.  Among these are <www.fivethirtyeight.com> and <www.electoral-vote.com>.  

 

 

References

 

Kolacinski, J.F., Mercier, N., Althouse, A. "A Presidential Election Game, 2008 Edition". MapleSoft Application Center.

http://www.maplesoft.com/applications/view.aspx?SID=89943

 

http://www.fivethirtyeight.com/

http://web.archive.org/web/20081106113055/http://www.fivethirtyeight.com/ accessed on 10 June 2011

http://en.wikipedia.org/wiki/Red_states_and_blue_states accessed on 15 June 2011.

 

 

 

Legal Notice: © 2011, J. F. Kolacinski, A. Culpepper and Maplesoft, a division of Waterloo Maple Inc.  Maplesoft and Maple are trademarks of Waterloo Maple Inc. Neither Maplesoft nor the authors are responsible for any errors contained within and are not liable for any damages resulting from the use of this material.  This application is intended for non-commercial, non-profit use only. Contact the authors for permission if you wish to use this application in for-profit activities.