# Simulating the U.S. Presidential Election of 2016

Regardless of who you support in the upcoming U.S. election, we can all agree that it’s been a very bumpy ride! It’s been a particularly chaotic election cycle. Wouldn’t it be nice if we could peek into the future and see potential election results right now? That’s what we'll do in this post!

In 2012, I used binary logistic regression to predict that President Obama would be reelected for a second term. That model requires that an incumbent is running for reelection. With no incumbent this time, I’ll need another approach. I’ve decided to use a Monte Carlo simulation.

By simulating the election 100,000 times, we can examine the distribution of outcomes to determine probabilities for the election winner and to determine which states are the most important to win.

## Using Monte Carlo Simulation for the Election

Monte Carlo simulations use a mathematical model to create simulated data for a system or a process in order to evaluate outcomes. I’ll simulate the upcoming election 100,000 times so we can determine which outcomes are more common or rare.

Imagine if we flip 50 coins. Basic probability tells us we should expect 25 heads and 25 tails, but while that is the most likely outcome, it happens only 11% of the time. There is a distribution of other outcomes around the most likely outcome.

The Monte Carlo simulation essentially treats the election as if we were flipping 51 coins (the states plus the District of Columbia). However, we’re using funny coins. For one thing, they have Donald Trump on one side and Hillary Clinton on the other! Also, these coins don’t necessarily have a 50/50 probability, and the probability changes over time. Currently, the Texas coin has 93% chance of showing Trump while the Wisconsin coin has an 80% chance of showing Clinton. The Florida coin, which is very important in our simulation, happens to be very balanced. It has a 51.1% chance of showing Clinton and 48.9% chance of showing Trump.

The U.S. Presidential election awards electoral votes to the winner of each state and the District of Columbia. The winner of a state gets all of the electoral votes for that state, which varies by population. When a candidate obtains 270 or more electoral votes, he or she wins the election.

I’ll have each state and Washington, D.C., flip their coin 100,000 times using the probabilities that Nate Silver calculated on November 2, 2016. The transfer equation for this simulation awards the electoral votes to the winner of each state.

## Simulation Results for the Presidential Election

The simulation results show that Hillary Clinton currently has the advantage. Over the 100,000 simulated elections, Clinton’s electoral votes range from 149 to 412, with the most likely value of 301. In 95% of the simulated results, Clinton’s electoral votes fall within the range of 247 to 355. Clinton obtains at least 270 electoral votes in 87% of the simulated elections.

While the simulation gives Clinton an overall 87% chance of winning, the probabilities change as candidates win specific states. For example, Florida is a crucial state in this election because it has the largest single state impact on a candidate’s probability of winning the election.

The pie chart shows the probabilities of winning based on the winner of Florida. If Trump doesn’t win Florida, he is essentially out of the race. In simulated elections where Clinton wins Florida, Trump wins the election only 2.5% of the time.

## Using Binary Logistic Regression to Dig Deeper into the Simulation

We can also use binary logistic regression to probe our simulated results. Binary logistic regression produces odds ratios that help us identify the states which have the greatest impact on a candidate's probability of winning the election.

Here, an odds ratio represents the odds of winning the election if a candidate wins a given state divided by the odds of winning the election if a candidate loses that state. The larger the odds ratio, the more important the state is to win. Among the battleground states, there is quite a large range of odds ratios—from Florida at 137.3 to Iowa at 2.7. The list includes the top 10 battleground states.

 State Odds ratio Florida 137.3 Pennsylvania 29.7 Ohio 23.3 Georgia 15.8 Michigan 15.3 North Carolina 13.4 Virginia 9.2 Arizona 6.8 Wisconsin 5.5 Colorado 4.6

The list is pretty cool because it quantifies the importance of each state, and the top states match those you hear about on the news media most frequently.

## What to Watch for on Election Night

This simulation indicates that Hillary Clinton is favored to win the election. Consequently, I’m going to focus on what it will take for Donald Trump to win. The five most important states can indicate the direction that the entire election is headed. As an added benefit, these states are mostly in the Eastern time zone, so you can use them to gain an earlier idea of who will ultimately win and how the close the election is likely to be.

Here’s how to read the table below. I start out with the assumption that Trump wins Florida because otherwise he has only a 2.5% chance of winning. For each subsequent row in the table, I add in the next state from the top 5 in which he has the greatest probability of winning and indicate both the chance of winning that state and the election. For example, the second row shows that Trump has an 83.9% chance of winning Georgia and, if he wins both Florida and Georgia, he has a 26.9% chance of winning the election.

Each additional row after Georgia represents a state that is harder for Trump to win. Trump has to win at least four of these states to have a greater than 50% chance of winning the election.

 Trump States Chance of Trump Winning Most Likely Electoral Votes Florida (48.9%) 23.9% 285 Clinton FL + GA (83.9%) 26.9% 283 Clinton FL + GA + OH (61.2%) 37.2% 276 Clinton FL + GA + OH + PA (22%) 70.5% 278 Trump FL + GA + OH + PA + MI (21.2%) 91.9% 291 Trump

The table gets tough for Trump starting in the fourth row, where he needs to win Pennsylvania. However, if he wins Florida, Georgia, and Ohio—which is not an extremely unlikely combination—he'll have a 37% chance of winning the election. In this specific scenario, the electoral vote is likely to be closer than many might expect because Clinton's most likely number of electoral votes is 276. Of course, there is a margin of error around this expected value, which is why Trump has a chance to win.

In short, right now it is difficult for Trump to win, but it is entirely possible that the election will be a squeaker! Watching these key states will give you a forecast of where the race is headed.

There are a few caveats for these results. The probabilities for winning the election are based on simulated results. The underlying state probabilities are based on the status of the race on November 2 and these can change by Election Day. Additionally, early voting has already commenced in a number of states in which the state probabilities were different than they are now.

Despite these caveats, this Monte Carlo simulation shows the overall state of the race and which states are most important for a candidate’s chances of winning.