Thursday, October 13, 2016

Election Simulator

Election Simulator with Spoiler Effect Odds


The election simulator is now up and running! You can use it to predict elections, but it’s also designed to measure the likelihood of a third-party spoiler effect and to identify which states could be at risk.

You can find the election simulator at the footer of the blog (scroll alllll the way down). It’s very simple:
  1. Choose a 3-party presidential race from the drop-down.
  2. Hit the “Run Simulation” button.

I’ve preloaded the simulator with data for the 2016 U.S. presidential election and a handful of other historical 3-party races that are interesting for a variety of reasons. More on that later.

Interpreting the Simulator Data


Right now the election simulator gives you some basic information about the candidates who ran in a given year, which way (conservative vs. liberal) the third party candidate leans and how many simulations it runs.

The results show you how often the Republicans win, how often the Democrats win, how often the third party wins, and how often a spoiler occurs. The results are shown for both the nation as a whole and the individual states. For states, I also show the historically-accurate electoral value and the “Spoiler Share,” which is the percentage of nation-wide spoilers which  each state contributed.

How Does It Work?


I started by feeding in state-level popular vote percentages. These can come from anywhere, but generally from polling data. For the current election, I’ve borrowed the aggregated meta-polls from popular statistician Nate Silver’s website FiveThirtyEight as of October 7, 2016. I’ve also been following their methodology, which I’ll summarize shortly. I chose to use FiveThirtyEight as the foundation, because they predicted 49/50 states in 2008 and 50/50 in 2012.

For past elections I’ve been using the historical results as inputs. This is admittedly cheating, but I introduce error factors to compensate, generating reasonable “what if” scenarios if normalized alternative fluctuations had occurred. If someone has the pre-election prediction values for any election, please send me a copy/link!

I then generated vote counts per party in each state, with a normal distribution around the predicted mean and a standard deviation of 4.5 percentage points. This is a simplification, because different population sizes, samples sizes, and other biases lead to a lot of state-to-state variation in poll accuracy, but this baseline generated results within 1% of FiveThirtyEight’s 2016 simulation. I used smaller standard deviations for the historical data. I also implemented a national error with a linear distribution between +/- 3.3 which simulates the possibility of innate bias in polling (for instance, there might be political biases in the type of people who own phones or who answer surveys). These numbers fit Gallup poll’s historical accuracy, and again, recreated FiveThirtyEight’s results quite well.

I then simulated the election (I’ve been running batches of 1,000,000 trials) and looked at the results with a 3-party race and a 2-party race. Contrasting the results highlights whether a spoiler effect occurred. Sometimes states can experience a spoiler effect, but if it isn’t enough to change the outcome of the nation-wide election, it doesn’t count. However, multiple states can collaborate to cause a spoiler.

Critical to determining whether a spoiler effect occurs is a left/right-leaning factor. This is the percentage of a third party’s voter base that would have voted Democrat over Republican or vice versa (and subtracting people who would have stayed at home). This leaning factor is hard to accurately determine, so I’ve made educated guesses (displayed at the top of the simulation results) based on my not-terribly-scientific historical research. I’ve not taken into account state-by-state variation in third-party leaning, which could probably be done with more accurate demographic information.

What Are the Odds of a Spoiler Effect in 2016?


For our current election I’m using generous error factors (compared to the historical data) to simulate uncertainty. I have separate options to show how the Libertarian party and Green party affect the election. Both are doing well, benefiting from record-setting strongly-unfavorable ratings for both mainstream candidates. Both partiesare showing a leftward lean and at higher levels than 2012, in part due to gaining disaffected Bernie Sanders supporters and Democratic non-interventionists, although this may change as more moderate Republicans withdraw support from Donald Trump and look for an alternative. Gary Johnson is doing around eight times better than Jill Stein, but Stein leans more left.

Johnson shows about a 4.3% chance of a national spoiler. Not negligible, but his voter share is going consistently down. If a spoiler effect does take place, it would mostly likely be in Florida (14.7%), Pennsylvania (12.0%), Ohio (11.9%), Michigan (10.8%), North Carolina (10.5%), Colorado (10.5%), Virginia (10.1%), Wisconsin (9.1%), or Arizona (8.5%). No surprises there. Those are this year’s battleground states and the simulation bears out our expectation that battleground states are almost always spoiler risks.

Are there any surprises? The 7.5% spoiler share in solidly-blue New Mexico is interesting. It’s caused by Johnson enjoying 16.1% of the popular vote there, meaning that if a surprise Republican victory did occur, it would almost certainly be by a margin the Libertarians could have bridged. Iowa has a 6.9% share, which you’d think would be higher given that it is such a close race there, but at six electoral votes, Iowa isn’t especially critical to the overall outcome.

Stein shows about a 3.8% chance of a spoiler, a little higher than I would expect given her much smaller voter base, but many of the battleground states are so close that the Green Party matters in many of the same places listed above. They also lean harder left than liberals, both for classical reasons like environmentalism and newer ones like net neutrality.

Simulations of Interesting Historical Elections


1912 Election – Teddy Roosevelt’s Progressive Party


The Progressive Party is the most successful third party in U.S. history, and the only one to beat a first party candidate. Roosevelt crushed his Republican friend-turned-rival, William Taft, who’d prevailed over him in the primary. The 54-46 schism within the conservative voter base was devastating, handing Woodrow Wilson a landslide victory. Notably, Socialist Eugene Debs managed a respectable 6%, but it didn’t chip away enough from the Democrats to matter.

In the simulation, the Democrats have won every time. 98% of their wins was due to a third party spoiler, largely due to a huge Progressive voter turnout which carved almost exclusively from the Republican side of the aisle. This is the most definitive spoiler effect in U.S. presidential history. Interestingly, New York, which then had 45 electoral votes, is the most frequent culprit, participating in 95% of the spoilers.

1968 – George Wallace’s American Independent Party


George Wallace’s American Independent Party is the most recent third party to win electoral votes, stealing mostly from the Republican side. He campaigned on a “law and order”and racial segregation platform that appealed to Republican-leaning ruralsoutherners and Democrat-leaning blue-collar union workers. Though he fell short, Wallace hoped to deprive the mainstream candidates of an electoral majority, which would have forced the House of Representatives to choose a winner.

The simulation still shows Nixon winning 91% of the time. In 99% of the cases where Nixon lost, Wallace is to blame, but history didn’t play out that way. If a spoiler had taken place, it would likely have been in Texas and/or Maryland.

1980 – John Anderson?


Why bother simulating Reagan’s landslide victory in 1980? Partly as a sanity check. Indeed, my simulation shows essentially 0% chance of a Democratic win for Jimmy Carter and a ~0% chance of a spoiler effect, though the occasional lottery-odds flukes in my million-loop simulations are fascinating.

Third party candidate John Anderson was a moderate Republican who split from the party and ran on a campaign that supported the Equal Rights Amendment, drawing support from women and liberal intellectuals. Anderson actually hit 15% of the popular vote in time to qualify for the presidential debates (Carter chose to boycott in protest), but later fell to 6.6% by the general election. At the end of the day Anderson ended up splitting Carter’s vote slightly more than Reagan’s, hurting Carter’s already doomed campaign.

1992 – Ross Perot’s Independent Party


Ross Perot’s Independent Party is interesting for managing 18.9% of the popular vote, and yet not really causing a spoiler effect in my simulations (a mere 0.4%). The reason is Perot's delicate balancing act of luring voters from both parties in almost exactly equal numbers. Clinton’s 5.6% margin victory over George H. W. Bush was too wide to be bridged by Perot’s truly very independent and centrist base.

Even if a spoiler had taken place, it would probably have benefited Clinton. It would most likely have taken place in California, which had a 25% share in 1992’s rare spoiler scenarios.

2000 – Ralph Nader’s Green Party


The classical spoiler effect cited in the modern era, which I’ve already written about at length. Ralph Nader’s Green Party borrowed enough liberals to split a close race and push the election in the Republican’s favor. The Democrats were heavily concentrated, but in too few states. Despite the Democrats having an edge in the popular vote, my simulation confirms that the Republicans really were favored to win under these conditions.

The simulation shows a 24% chance of a spoiler effect, caused more by the closeness of the race than the Green party’s ideological lean or popular sway (they only managed 2.74% of the vote). As one would expect, Florida is the most prominent game changer (43%), followed by New Hampshire (25%), Wisconsin (22%), New Mexico (22%), and Oregon (20%).

2012 – Gary Johnson’s Libertarian Party


Last election saw both Libertarian Gary Johnson and Green Jill Stein appear on the scene, though they hadn’t yet gained their 2016 name recognition. They raked in a relatively lackluster 0.99% and 0.36% of the popular vote respectively. Simulating 2012 shows a typical 2-party race with a somewhat larger than average margin of victory, not uncommon for an incumbent president.

In the simulation, Barack Obama beats Mitt Romney about 98% of the time. A spoiler effect occurs in only about 0.18% of cases, with Florida, Ohio, and Pennsylvania rounding out the usual suspects. The low odds are partly due to a Republican victory being such a long shot and partly because the Libertarian party was particularly left-right neutral in 2012. Though commonly associated with the GOP because of their small-government, anti-tax, and pro-gun stances, they also appeal to liberals due to opposing Citizens United and supporting abortion rights, legalized marijuana, and gay marriage.

Election Simulator 2.0


If you haven’t already, take a moment to play around with the election simulator. Leave a comment if you have ideas for what you’d like to see next and I’ll see what I can do.

For instance: 
  • Other election years
  • User control of left-right leaning factor
  • User control of state and national error factors
  • User control of number of simulations
  • Graphs and maps of data

3 comments:

  1. What is your take on Abraham Lincoln being a third-party candidate in 1860, as Jill Stein and others have asserted? I can almost buy it, but it was a complicated election anyway, what with the Whigs basically disappearing and the Democrats being split into two parties. To me, the real question is if the Southern Democrats were really the third party (and the Constitutional Union party the "other" third party) because the Republicans had already ascended to being the second mainstream party in a few short years.

    ReplyDelete
    Replies
    1. If you look at 1856 when the Whig party fell apart, you can see pretty clearly that the Whigs became the Republicans with Southern Whigs forming the "Know Nothing" party under Fillmore and by 1860 the Constitutional Union party. When the Democrats split the Southern Democrats were the more powerful, so I would say that Lincoln was a liberal mainstream candidate, Breckinridge a conservative mainstream candidate, Bell a liberal 3rd party candidate and Douglas a conservative 3rd party candidate.

      Great topic! I'll do a whole post on it later. For now, I've scrambling to cover Evan McMullin and deadlocks!

      Delete
    2. Hard to say which of the two Democrats was the mainstream and which the "third party": Breckinridge received six times more electoral votes, but Douglas received 50% more of the popular vote. Weird. But I agree that fundamentally the Republicans had already ascended to being a mainstream party, and thus the "Lincoln was the first successful third party candidate" narrative is not tenable.

      Delete