Skip to content

Commit

Permalink
explanation of methods
Browse files Browse the repository at this point in the history
  • Loading branch information
wmentrekin committed Oct 29, 2020
1 parent 3617892 commit adcd41f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
border-collapse: collapse;
border: 2px black solid;
font: 12px sans-serif;
text-align: center;
}
td {
border: 1px black solid;
Expand Down Expand Up @@ -72,6 +73,34 @@ <h1>2020 United States Presidential Election Model</h1>
</p>
</header>

<section>
<h2>Methods</h2>
<p>
<b>Disclaimer</b>: This model is not an official prediction. I am in no way attesting to its potential accuracy or claiming it to be correct.
The point of this project was to be a learning exercise for me as well as an outlet for an interest of mine. The data you see here is purely a result
of my model and I am not in any way a professional election forecaster. Nonetheless, I hope this peaks your interest.
</p>
<p>
When I first decided to begin working on this model in August, I wanted to challenge myself to learn more about different Python libraries,
such as Scipy, Numpy, Pandas, and Matplotlib and to see if I could come up with anything accurate at all. I utilized my prior skills in webscraping
and data manipulation while using new knowledge in statistics and data visualization. The entire model is written in Python.
</p>
<p>
This model essentially uses election data from 2016 and polling for this current election cycle to create a rough forecast of the 2020 election.
I gathered data about all 50 states and the District of Columbia from <a href="https://www.census.gov/">the census website</a>,
2016 election data from <a href='https://www.fec.gov/'>the FEC website</a>, 2020 election polling data from <a href='https://www.270towin.com/'>270 to win</a>,
and pollster ratings and bias from <a href='https://fivethirtyeight.com/'>538</a>.
</p>
<p>
After the data was gathered and cleaned, I had three classes of objects: States, Polls, and Pollsters. I wanted to use the data I gathered about each of these objects,
to implement this model. The model thus breaks down into these parts: correcting polls based on the grade and historical bias of their pollsters,
aggregating polls in each state into a singular rating with a vote share for both candidates and margin of error based on the combined margins of all the polls
(for states with no polling data, this rating was simply based on the 2016 election results, as states with no polling data are not assumed to be competitive
or chance much in their results from the prior election cycle), combining the prior election results and the ratings for each state into distributions of possible vote share
for each candidate in each state, simulating 10,000 races in each state, and visualizing the data with the map and graphs you see below.
</p>
</section>

<div class="container">
<h2>Average Margin of Victory</h2>
<img src="results/map.png" alt="Average Margin of Victory" width="800" height="536">
Expand Down

0 comments on commit adcd41f

Please sign in to comment.