Add files via upload

This commit is contained in:
Peter Norvig 2019-07-06 10:47:57 -07:00 committed by GitHub
parent e5d52dc278
commit bd3daab7fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 109 additions and 92 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<div align=\"right\"><i>Peter Norvig<br>2 June 2019</i></div>\n",
"<div align=\"right\"><i>Peter Norvig<br>3 July 2019</i></div>\n",
"\n",
"# Tracking Trump: Electoral Votes Edition\n",
"\n",
@ -22,8 +22,7 @@
"\n",
"# TL;DR for policy wonks\n",
"\n",
"As of 2 July 2019, Trump would expect **167 electoral votes** under these assumptions (recall that you need **270** to win). If you ran states in order of his approval, the key turning-point state is Pennsylvania; he'd need to win that and every state in which he is more popular. He currently is **9% behind in Pennsylvania**. \n",
"He's been below 270 every month for the last two years, and that remains true even if you factor in an across-the-board 3% swing in his favor (which was the swing above polls that he experienced in 2016).\n",
"As of 2 July 2019, Trump would expect **167 electoral votes** under these assumptions (you need **270** to win). If you list states in order of his approval, the key turning-point state is Pennsylvania; he'd need to win that and every state in which he is more popular. He currently is **9% behind in Pennsylvania**. \n",
"\n",
"\n",
"# The details for data science nerds\n",
@ -37,7 +36,7 @@
"\n",
"- **Movement**: What's the most a state's net approval could be expected to move, due to random fluctuations (that is, assuming there is no big event that changes people's minds)? I define the maximum expected **movement** of a state as 1/5 of the undecided voters (i.e. assume the undecided voters broke 60/40 one way or the other) plus 2 standard deviations in the net approval over the last 12 months. \n",
"\n",
"- **Swing state**: I define a swing state as one whose maximum expected movement is greater than the absolute value of the net approval. There are 16 such states now; if Trump won them all, he would still lose the elction. Some states that are traditionally considered swing states are out of reach for Trump under my model: he currently trails in Pennsylvania by 9%, in Wisconsin by %14, and in Michigan by %15. My model says these states can be expected to move by no more than 5%. Some traditionally solid Republican states are swing states in my model, such as Texas, which has Trump at +4%, but has 4% undecided voters.\n",
"- **Swing state**: I define a swing state as one whose maximum expected movement is greater than the absolute value of the net approval. There are 16 such states now; if Trump won them all, he would still lose the election. Some states that are traditionally considered swing states are out of reach for Trump under my model: he currently trails in Pennsylvania by 9%, in Wisconsin by %14, and in Michigan by %15. My model says these states can be expected to move by no more than 5%. Some traditionally solid Republican states are swing states in my model, such as Texas, which has Trump at +4%, but has 4% undecided voters.\n",
"\n",
"- **Margin**: Suppose a future event swings voters in one direction or another uniformly, across the board in all states. How much of a swing would be necessary to change the election outcome? We call that the **margin**. Today **Trump's margin is 7%:** if he got 7% more votes in all states he would be over 270 electoral votes. (This could come, for example, by convincing the 3% of undecided voters to break for him at a 2% to 1% ratio, and then convincing 3% of disapproving voters to switch to approving.)\n",
"\n",
@ -58,7 +57,7 @@
"text": [
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
" Dload Upload Total Spent Left Speed\n",
"100 116k 0 116k 0 0 15866 0 --:--:-- 0:00:07 --:--:-- 31316\n"
"100 116k 0 116k 0 0 286k 0 --:--:-- --:--:-- --:--:-- 286k\n"
]
}
],
@ -130,7 +129,7 @@
" '1-Jun-18': -11, '1-Jul-18': -10, '1-Aug-18': -12, '1-Sep-18': -14,\n",
" '1-Oct-18': -11, '1-Nov-18': -11, '1-Dec-18': -10, '1-Jan-19': -12,\n",
" '1-Feb-19': -16, '1-Mar-19': -11, '1-Apr-19': -11, '1-May-19': -12,\n",
" '1-Jun-19': -12}"
" '1-Jun-19': -12, '1-Jul-19': -11}"
]
},
{
@ -215,11 +214,22 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"9"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# What across-the-board increase in percentage approval would he need to win?\n",
"# What across-the-board increase in approval would he need to win?\n",
"margin(states)"
]
},
@ -261,7 +271,7 @@
"source": [
"We see that:\n",
"- Trump is currently leading in states with only **167** electoral votes; \n",
"- The margin is **9%** (if he got 9% more popular in every state, his expected total would be over 270).\n",
"- The margin is **9%** (if he got 9% more popular in key states, his expected total would be over 277.5).\n",
"- Swings from 0 to 10% produce electoral vote totals from 167 to 292."
]
},
@ -271,7 +281,7 @@
"source": [
"# Electoral votes by month\n",
"\n",
"The following plot shows, for each month in office, the expected number of electoral votes (based on net approval) with error bars indicating a 3% swing in either direction (Why 3%? That was the [average error](https://fivethirtyeight.com/features/the-polls-are-all-right/) in national presidential polls in 2016: Clinton was predicted by polls to win the popular vote by 6% but actually only won by 3%.) Trump hasn't been above 270 since 4 months into his term, and even with the 3% swing, since 6 months in."
"The following plot shows, for each month in office, the expected number of electoral votes with error bars indicating a 3% swing in either direction (Why 3%? That was the [average error](https://fivethirtyeight.com/features/the-polls-are-all-right/) in national presidential polls in 2016: Clinton was predicted by polls to win the popular vote by 6% but actually only won by 3%.) Trump hasn't been above 270 since 4 months into his term, and even with the 3% swing, since 6 months in."
]
},
{
@ -436,7 +446,9 @@
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {

View File

@ -204,7 +204,7 @@ Ride Sun, 12/6/2015 Canada Rd 2:15:05 34.67 mi 1,237 ft
Ride Wed, 9/13/2017 Healdburg / Jimtown 2:08:03 34.45 mi 912 ft
Ride Thu, 10/2/2014 10/02/2014 Mountain View, California 3:08:06 34.28 mi 2,864 ft
Ride Sat, 2/1/2014 OLH to Page Mill 3:07:43 34.26 mi 3,099 ft
Ride Sat, 10/21/2017 Pescadero 2:47:08 34.25 mi 2,556 ft
Ride Sat, 10/21/2017 Pescadero 5:20:08 67.05 mi 4,938 ft
Ride Sat, 7/30/2016 Morning Ride 2:50:15 34.19 mi 2,799 ft
Ride Mon, 7/10/2017 Morning Ride 2:38:59 34.18 mi 984 ft
Ride Thu, 7/31/2014 Work commute 2:36:53 34.15 mi 564 ft
@ -227,7 +227,6 @@ Ride Sun, 5/12/2019 Peninsula Bike Trail to Bay Trail 2:29:05 33.00 mi 846 ft
Ride Sun, 8/20/2017 Lunch Ride 2:23:02 32.96 mi 1,407 ft
Ride Sun, 3/6/2016 Lunch Ride 2:57:54 32.86 mi 2,566 ft
Ride Sun, 3/5/2017 Lunch Ride 2:57:09 32.82 mi 1,713 ft
Ride Sat, 10/21/2017 Back from Pescadero 2:36:50 32.80 mi 2,382 ft
Ride Sat, 12/16/2017 Morning Ride 2:48:58 32.72 mi 2,320 ft
Ride Tue, 8/23/2016 Morning Ride 2:32:15 32.61 mi 354 ft
Ride Fri, 12/9/2016 Morning Ride 3:04:52 32.55 mi 2,365 ft
@ -436,3 +435,6 @@ Ride Mon, 9/5/2016 Afternoon Ride 1:42:56 25.00 mi 902 ft
Ride Sat, 11/8/2014 Atherton - Woodside 1:40:51 25.00 mi 972 ft
Ride Sun, 12/10/2017 Exercise Bike 1:30:00 25.00 mi 0 ft
Ride Sun, 6/2/2019 The Sequoia 6:40:43 77.51 mi 6,467 ft
Ride Sat, 6/8/2019 Morning Ride 2:53:08 34.42 mi 1,824 ft
Ride Sat, 6/15/2019 Morning Ride 2:29:38 29.98 mi 1,785 ft
Ride Fri, 7/5/2019 Morning Ride 4:30:55 64.05 mi 1,965 ft
Can't render this file because it has a wrong number of fields in line 40.