211 lines
8.8 KiB
Markdown
211 lines
8.8 KiB
Markdown
# Nuño's simple electoral college simulator
|
|
|
|
## About
|
|
|
|
This is a simple model of the US electoral college. It aims to be conceptually simple and replicatable. Currently, it incorporates data from the electoral history in each state, since the 2000 election, as well as states-specific polls, if they exist.
|
|
|
|
Other projects, like [538](https://en.wikipedia.org/wiki/FiveThirtyEight), [Nate Silver's substack](https://www.natesilver.net/) or [Gelman's model](https://github.com/TheEconomist/us-potus-model) are to this project as a sportscar is to a walking stick. They are much more sophisticated, and probably more accurate. However, they are also more difficult to understand and to maintain.
|
|
|
|
## How to run
|
|
|
|
### Prerequisites
|
|
|
|
This model is written in go, an elegant language developed by Rob Pike, Ken Thompson and Robert Griesemer at Google. You can find installation instructions for all major platforms [here](https://go.dev/dl/). In addition, it uses git for distribution. You can find installation instructions for git [here](https://git-scm.com/downloads).
|
|
|
|
You can thus get the model with:
|
|
|
|
```
|
|
git clone https://git.nunosempere.com/NunoSempere/2024-election-modelling
|
|
cd 2024-election-modelling
|
|
go install
|
|
```
|
|
|
|
And run the model with:
|
|
|
|
```
|
|
go run main.go
|
|
```
|
|
|
|
In addition, on Linux you can update the polls with make:
|
|
|
|
```
|
|
make polls
|
|
```
|
|
|
|
## What stories does the model tell?
|
|
|
|
### The naïve baserate story
|
|
|
|
Consider Ohio. Bush won the state in 2000 and 2004, Obama in 2008 and 2012, and Trump again in 2016 and 2020. The base rate, the historical frequency for republicans in Ohio is therefore 4/6.
|
|
|
|
A straightforward way of getting at a probability of an electoral college win is to just take the historical frequency for each state, and sample from it many times, and then build up the different electoral college results from those samples.
|
|
|
|
If we do so, however, Republicans end up with only a 25% chance of winning the 2024 election.
|
|
|
|
Why is this? Well, consider the number of electoral college votes in the last few elections:
|
|
|
|
| Year | Republican electoral college votes | Democrat electoral college votes |
|
|
| ---- | --- | --- |
|
|
| 2000 | 271 | 266 |
|
|
| 2004 | 286 | 251 |
|
|
| 2008 | 173 | 365 |
|
|
| 2012 | 206 | 332 |
|
|
| 2016 | 304 | 227 |
|
|
| 2020 | 232 | 232 |
|
|
|
|
Essentially, Obama won by much more than Bush, Trump or Biden. But our naïve model doesn't see that those results were correlated.
|
|
|
|
So the story here is that our model is not very sophisticated. But another might be that Obama was much more popular than Biden, and if Democrats can tap into that again, they will do better.
|
|
|
|
### The polls story
|
|
|
|
If we only look at polls (and use baserates when there are no polls—which happens for states like Alabama, which lean strongly towards one party already), this time the Republicans win by a mile: with 95% probability.
|
|
|
|
What's happening here is that:
|
|
|
|
- There aren't that many polls yet
|
|
- For the polls that do exist, Trump polling very well in Pennsylvania, Wisconsin, Arizona, Michigan, Florida, Nevada, Georgia, North Carolina
|
|
- Trump is also polling decently in Minessota; Biden is polling well in Colorado
|
|
- In part, this is because Biden is just [unpopular](https://projects.fivethirtyeight.com/biden-approval-rating/), or at least more than [Trump](https://projects.fivethirtyeight.com/polls/favorability/donald-trump/)
|
|
- In part though, polls currently also ask about the third party vote: for Robert F. Kennedy, Kayne West and Jill Stein (Green party).
|
|
- In a normal democracy, like in Spain, a protest party could amass some electors, and use them as bargaining chips to govern together with one of the other major parties. For instance, this is what happened with Ciudadanos in Spain. Perhaps third parties performing strongly could conceivably, create pressure to reform the US electoral system.
|
|
- In the US, with the system as currently exists, these votes seem to favour Trump.
|
|
|
|
## Notes on other models
|
|
|
|
**FiveThirtyEight** [2020](https://fivethirtyeight.com/features/how-fivethirtyeights-2020-presidential-forecast-works-and-whats-different-because-of-covid-19/), [2016](https://fivethirtyeight.com/features/a-users-guide-to-fivethirtyeights-2016-general-election-forecast/)
|
|
|
|
Notes on 2020:
|
|
|
|
- Adjusted for COVID pandemic
|
|
- Manually increased uncertainty
|
|
- More fundamentals
|
|
- Looking back until 1880
|
|
- Adjustments for changed partisanship
|
|
- Covariance between states based on similarity metrics
|
|
- Changes on how easy it is to vote
|
|
- Polling averages. Explained further [here](https://fivethirtyeight.com/features/our-new-polling-averages-show-biden-leads-trump-by-9-points-nationally/)
|
|
- Polls as capturing a snapshot. Uncertainty should increase. Things can happen between now and the election.
|
|
- Weighted by pollster performance
|
|
- Trend line of the polls
|
|
- Likely voter adjustment
|
|
- Polling house adjustment
|
|
- "CANTOR" similarity scores
|
|
- "swinginess" of a state
|
|
- recency adjustments
|
|
- Adjustements after major events. Debates, conventions, VP picks
|
|
- Demographics, past voting patterns
|
|
- Priors
|
|
- Incumbency
|
|
- Economic conditiosn
|
|
- Partisan lean: in the last two elections
|
|
- In our partisan lean index, 75 percent of the weight is assigned to 2016 and 25 percent to 2012. So note, for example, that Ohio (which turned much redder between 2012 and 2016) is not necessarily expected to continue to become redder
|
|
- Home states of president and VP
|
|
- Various complicated regressions
|
|
- One simple one is: polling for Northeast, Midwest, south, west
|
|
- Ensemble forecast + polling average
|
|
- Weight depends on quantity of polling
|
|
- 55% to polling average in August
|
|
- 97% to well polled states towards the end of the campaign
|
|
- Fundamentals based on economics
|
|
- Index of economic conditions
|
|
- nonfarm payrolls
|
|
- spending
|
|
- income
|
|
- manufacturing
|
|
- inflation
|
|
- stock market
|
|
- normalized, weighted for recency
|
|
- other factors
|
|
- incumbency
|
|
- polarization
|
|
- forecast of those economic variables
|
|
- relatively little weight to fundamentals, declining to zero by election day
|
|
- August: 77% to polling ensemble, 23% fundamentals
|
|
- Accounting for uncertainty:
|
|
- national drift.
|
|
Constant x (Days Until Election)^⅓ x Uncertainty Index
|
|
- national election day error. Errors in final polls since 1936.
|
|
- this is key, and tractable. [source](https://news.gallup.com/poll/110548/gallup-presidential-election-trial-heat-trends.aspx)
|
|
- More difficult to do this state by state, but it's a start
|
|
- Also doable in advance
|
|
- correlated state error
|
|
- also key
|
|
- based on demographics
|
|
- state-specific error
|
|
- Uncertainty index. Its own involved thing.
|
|
- 40,000 simulations each time the model is updated.
|
|
- This is relatively little, compared to my 10M
|
|
- Not account for probability of faithless electors, nor shenanigans
|
|
|
|
**[Gelman](https://projects.economist.com/us-2020-forecast/president/how-this-works)**
|
|
|
|
## Roadmap
|
|
|
|
It's not clear to me what I will do with this. As a result of writting down the model, I've realized that 80/20-ing a 538 would involve more effort than what I was expecting
|
|
|
|
### To do
|
|
|
|
General:
|
|
|
|
- [ ] Share with Samotsvety
|
|
- [ ] Implement possible next steps:
|
|
- Uncertainty due to drift between now and the election
|
|
- Uncertainty due to difference between last election poll and final vote share
|
|
- [ ] Better prior by incorporating more past elections
|
|
- Think about how to:
|
|
- [ ] Inject error
|
|
- [ ] Inject correlated error
|
|
- [ ] Think about whether I want to monetize this
|
|
- Maybe with Vox?
|
|
- Otherwise: add MIT license & publish
|
|
- [ ] Think about whether I want to add other collaborators
|
|
- If so, add contribution sections, make available on github
|
|
|
|
Steps to make this more accurate:
|
|
|
|
- [ ] Think about correlation between states.
|
|
- How?
|
|
- [ ] Consider conditional probabilities
|
|
- See how other models account for the correlation
|
|
- [ ] Add more years
|
|
- [ ] Polling company errors
|
|
- [ ] Make polling errors wider?
|
|
- [ ] Economic fundamentals?
|
|
- [ ] Print more data for polls
|
|
|
|
### Done
|
|
|
|
Incorporate base rates:
|
|
|
|
- [x] Get past electoral college results since 2000
|
|
- [x] Get number of electors for each state with the new census
|
|
- [x] Combine the two to get an initial base rates analysis
|
|
|
|
Consider polls:
|
|
|
|
- [x] Download and format
|
|
- [x] Read
|
|
- [x] Add date of poll
|
|
- [x] Consider what the standards error should be
|
|
- [x] Consider how to aggregate polls?
|
|
- One extreme: Just look at the most recent one
|
|
- [x] Another extreme: Aggregate very naïvely, add up all samples together?
|
|
- [x] Aggregate polls?
|
|
- [x] Exclude polls older than one month?
|
|
- [x] Inspect polling stderrs
|
|
|
|
General
|
|
|
|
- [x] Work on README
|
|
- [x] Print states & polls separately
|
|
- [x] Histogram distributions of electoral college votes
|
|
- [x] Think about next steps
|
|
- [x] Get clarity on next steps
|
|
|
|
### Discarded
|
|
|
|
- [ ] ~~Add uncertainty using Laplace's law of succession?~~
|
|
- Maybe only do this for contested states? Alabama is not going to turn Democratic?
|
|
- [ ] ~~Exclude partisan polls => not that many of them~~
|