**This is an old revision of the document!** ----
====== Math 445 Lab 8: Predicting Presidential elections with Monte Carlo methods====== ====Background==== Statistician Nate Silver made a name for himself in the 2008 Presidential election by correctly predicting the Presidential election outcomes for 49 of 50 states and all 35 Senate races. He used purely statistical methods applied to polling data. His statistical models had two parts. First, he developed models of the bias of individual pollsters based on past elections and used this to form composite, unbiased models of the aggregate polling data in each state. Second, he ran a large number of computer-simulated elections based on the unbiased composite state-by-state poll data and their margins of error. An estimate of the likelihood of either candidate winning the Presidential election was then given by the fraction of simulated elections that that candidate won. In the 2012 elections Silver's projections received an enormous amount of attention, and quite a bit of criticism, too. Political pundits derided his work as meaningless number crunching and his 2008 results as lucky. But this time, Silver predicted the Presidential election correctly in all 50 states, and 31 of 33 Senate elections. ==== This lab ==== In this lab we will simulate the 2012 Presidential elections based on last-minute polling data. Essentially, we're pretending that it's 2012 Election Day and we're trying to figure out the odds that either Obama or Romney will win. The first part of Silver's model (constructing unbiased composite polls) is too complicated for us to do here, so we'll just do the second part (running a bunch of simulated elections based on the unbiased poll data). ---- **Problem 1: Predicting the New Hampshire Presidential election.** Just prior to the 2012 Presidential election, polls showed that 51.5% of New Hampshire voters planned to vote for Obama, and 47.8% planned to vote for Romney. Thus it looked likely that New Hampshire's four Electoral College delegates would go to Obama. But polling data is not entirely certain. The margin of error on the New Hampshire polls was estimated to be 3.4%. That is, the true intentions of New Hampshire voters could have ranged anywhere from 54.9% Obama and 44.4% Romney to 48.1% Obama and 51.2% Romney. Thus is was possible (if not likely) that Romney would win New Hampshire and take its four Electoral College votes. Your job for problem 1 is determine how likely it is that Obama or Romney would win 2012 New Hampshire based on this polling data, using Monte Carlo methods. Run 1000 simulated elections. For each election, start by assigning 51.5% of the vote to Obama and 47.8% to Romney. But then choose a random percentage of voters between -3.4% and 3.4%, and add that percent to Obama while subtracting it from Romney. Compare the resulting percentages and declare the winner of the simulated election to whomever hads the larger percentage. Do this 1000 times, and count how many times Obama wins and how many times Romney wins. From your results, determine the likelihood that Obama or Romney would win the State of New Hampshire in the 2012 Presidential election. Turn in your code for simulating the New Hampshire election (probably a Matlab script) and the percentage likelihoods that the election would go to Obama or Romney. ----- **Problem 2: Simulating the Electoral College votes of a few swing states.** Problem 1 demonstrated that New Hampshire was a swing state in the 2012 election --it could have gone either way. Colorado was another swing state. Polls showed it at 50.9% Obama and 48.2% Romney with a margin of error of 3.0%. New Hampshire had 4 Electoral votes and Colorado 9. All of a state's Electoral votes go to the candidate who gets the most votes. Your job for problem to is to estimate the likelihoods of four possibile outcomes of the New Hampshire and Colorado elections. - Romney wins both and gets 13 Electoral votes. - Romney wins CO, loses NH, and gets 9 Electoral votes. - Romney loses CO, wins NH, and gets 4 Electoral votes. - Romney loses both and gets 0 Electoral votes. Do this by simulating the New Hampshire and Colorado elections 1000 times. For each time, simulate a New Hampshire election and a Colorado election, as in problem 1. Award the Electoral votes of each state to the winner of that state. Record the Electoral results of each of the 1000 elections, and from this data determine the likelihood of each of the above four outcomes. Turn in your code and the likelihood of each of the four outcome as percentages. ---- **Problem 3: Simulating the elections in all fifty states and the likelihood that Obama wins the general election.** ...to be continued...