Setting with Copy Warning

One of the most frustrating issues in Pandas is the SettingWithCopyWarning. To a beginner in Pandas this can be one of the most frustrating issues to deal with. What becomes even more frustrating is that the documentation is not very helpful, and StackOverflow offers a ton of answers which don’t help either.

The answer is actually quite simple. Pandas Dataframes are similar to dictionaries in how they have indexes, and every row has a specific name. This is useful because it helps ensure that every item will be placed in the proper row.

To make this work without triggering the error, you need to make sure that when you are retaining the row index in the object you are creating with your desired values.

Here are two common situations which you might find:

Rename a specific column

A Pandas noob will be inclined to write the following:


price_lb=prices[prices['Data Item'].str.contains('LB')]
price_lb['Value per pound'] = price_lb['Value']

Which will return the following error:

:2: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
price_lb[‘Value per pound’] = price_lb[‘Value’]

How do we solve this?!?!

Well, we need our good friend pd.concat to solve this problem unambiguously:


temp_df = pd.DataFrame(price_lb['Value'])
temp_df.columns = ['Value per pound']
price_lb=pd.concat([price_lb,temp_df], axis=1)

This is what you should do in order to ensure that there is no potential mismatching of data. We know this works because temp_df.index is identical to price_lb.index.

Run an operation on a column

A Pandas noob will be inclined to write the following:

price_ton['Value']=[x.replace(',','').replace(' (S)','').replace(" (NA)",'') for x in price_ton['Value']]

This presents a problem, because this generates a list, which has a index which is from 0 to the length of the list. This most likely doesn’t match the index of the DataFrame!

So we need to run an operation on this column, but also retain the index. Lambda functions are your friend in this situation. Rewrite your function like so:


values=price_ton['Value'].apply(lambda x: x.replace(',','').replace(' (S)','').replace(" (NA)",''))

Values will now retain the index and column name of the original Dataframe!

You can then use a pd.concat() function to bring this information back into your original dataframe.


price_ton=pd.concat([price_ton,pd.DataFrame(price_ton['Value'].apply(lambda x: x.replace(',','').replace(' (S)','').replace(" (NA)",'')))], axis=1)

No warnings, and every datapoint is exactly where it belongs.

I hope this helps you write better Python code.

How I protect my accounts

I have several layers of protection on my most important accounts. In short, I use the following secure features:

  • Each account has a unique random password which is generated and stored in my Lastpass Vault
  • Lastpass requires Email authentication to login to a new device
  • The email I use for Lastpass has two factor authentication with my personal phone

So in order to steal my data you would need to:

  1. Randomly guess the password for my email account. If you make too many wrong attempts, any half decent website will lock your account for a few minutes. This means repetitively entering in passwords will not work. If my password is 10 digits long, where any character can be one of 96 possible characters on a US English keyboards, you are looking 6.65e19 possible combinations (66.5 quintillion in American English). If the website allows 3 wrong passwords in a 5 minute period, it would take over 2.1e14 years to guess every possible password on that one website. It doesn’t just lock out from that one device, it blocks ALL attempts from all clients for those 5 minutes. Random guessing and checking is simply not going to work.
  2. Randomly guess the password for my Lastpass account. Same math. This is not going to work.
  3. In the highly unlikely event where you randomly guessed my Lastpass password, and also my email password, you also need to have my personal phone on your person in order to access my account.

Don’t even try. It’s not worth your time.

Apple vs Google, smartphone edition

I recently changed from Android to iOS, and I have a number of thoughts on what the different carriers do differently. Neither is inherently better than the other, and come with some massive tradeoffs. If one of these companies chose to learn from the other, there would be millions of people migrating from one platform to the other.

Android Advantages:

  • USB-C is vastly superior to Lightning
  • Has far more options in terms of phones, allowing them to control the lower spec market
  • You can easily fix your phone and it won’t break itself.

Apple advantages:

  • They support their operating system for a longer time than Google.
  • Their processor is the best on the market.

Right now I wanted to have a phone which would last a long time without the OS breaking, so I switched back to Apple after using Android for 8 years. I switched to Android because Apple was being overly controlling with their app store, and were limiting consumer choice.

What we really need is a phone which has the following:

  • Hardware support with their operating system akin to how Linux works. It needs to be mostly hardware agnostic, and never stop providing updates just because your device is old. It should always offer updates to the operating system, and be light weight enough so that it won’t break (though the same cannot be said about apps which are built on top of the operating system).
  • Use standard open USB connectors
  • Someone should be able to take apart their phone, fix a piece of it, put it back together, and assuming they didn’t make a mistake in reassembly, the phone should still work.
  • High spec processor

That’s what I want. Any company which does this will gain a lot of users.

Control inflation while reducing inequality

America’s GDP per capita is at a record high.

Inflation is climbing.

Immediately we know that the issue is a soaring demand curve, with a supply curve which is struggling to keep up.

So the answer to controlling inflation is pretty easy, either reduce demand (which would also harm GDP) or increase supply.

Unemployment is at 4.6% so there really aren’t very many people to bring into the labor market right now.

Our employment-population ratio is nearing 60% again, which has been the low end of the range since 1983. There really aren’t very many Americans who want to work who are not working.

We need more workers in order to keep up with rising demand (and those workers will themselves demand goods and services, because duh).

Inequality has stayed in the 40-43 range since 1993. Many Americans (myself included) are concerned with continuously high inequality.

So what we really want to do is raise wages for low income and middle class households, increase the labor supply. there are two ways to do this, we can either subsidize child care and pay for it by raising taxes on the rich, which is two birds with one stone because it reduces inequality while also increasing the labor supply.

The other option is to increase the number of available work visas.

You can only increase child care so much, but we should obviously do it.

These would help solve the labor crunch, but these policies will not solve inflation.

When we look however at where inflation is concentrated, it’s highly concentrated in the energy sector. The price of oil has skyrocketed over the last year, increasing from under $50 per barrel to $80 per barrel today.

The President of the United States, nay, the entire United States government has very little control over the price of oil. It is a global market, and the United States has less than 2% of the world’s proven oil reserves. We also have one of the highest drilling rates in the world as a percentage of oil we have. We are a small fish in the oil market, and we are depleting our proven reserves at a faster rate than any other country.

1/3 of global oil production is in Russia and Saudi Arabia alone.

Of the top ten countries by proven oil reserves, only one of them is a democracy, and that country is Canada. While Canada has vast oil reserves, it has a relatively small population and much of the oil is in Alberta. To put that climate in perspective, Edmonton has an average daily temperature below freezing from November through March, 5 months out of the year. This oil is located under land which is frozen for several months out of the year. I’m sure this is part of the reason why Canada has the second lowest extraction rate out of the world’s 17 largest oil producers, second only to Venezuela which is an economic and political crisis.

Despite the United States having the third fastest extraction rate, we are still in a global market, and we still have no control over the oil price.

What makes this even more dire, is that we will run out of current proven reserves in the United States in less than 10 years unless if we find a significant amount of oil reserves hidden somewhere in the United States somewhere very soon.

If Canada were to increase its current oil extraction to the same rate as the United States it would last for 66 more years. Saudi Arabia and Venezuela are significant outliers in terms of their oil supply.

The harsh reality is that as long as the United States stays dependent on oil, our economy will be under the control of countries which are hostile to democracy. It’s just that simple.

We need to transition off of oil and continue to expand renewable energy as fast as we possibly can. That is the only way we can protect our economy from hostile foreign actors.

That is the only way we can protect our economy from inflation caused by hostile foreign actors.

References:

https://en.wikipedia.org/wiki/Oil_reserves

https://fred.stlouisfed.org

https://data.bls.gov/timeseries/LNS12300000

Why we should cancel student loan debt

The year is 1992, you just had a baby, and you live in Washington State. The cost of college at University of Washington is around $3000, and you talk to your financial advisor about how to plan to make it so your child has the best opportunity possible. You don’t live in poverty, so there is little financial assistance for people in your financial class. Your financial advisor says you need to invest in college, and given how college costs increase by only 4-6% per year on average, he recommends you invest in the stock market to pick up an average of 2% growth per year over the next 18 years. Plus this is tax deferred of course because it’s a 529 plan, so it’s a good plan all around.

Assuming college increases at an average of 5% per year, which was a reasonable estimate for the time, your financial advisor makes the same prediction anyone else with a knack for economics would predict, and that tuition at UW will be around $6600 when your kid hits college in 2011.

In order to invest so you have enough, he adds up the predicted cost and estimates that you will need to have around $20,000 saved up to cover tuition when your kid turns 18 in 2011, so you should talk to the grandparents of your child and work to save up $1000 per year for the first 6 years of your child’s life. This prediction will mean that you should be able to cover the cost of college, given a generous inflation rate and an average APR of 8%. This would have been good advice, and what many parents got in the early 1990s for their children’s college from financial advisors who are really good at their jobs.

In 2002 tuition at UW increased by 16%, but the difference between the prediction and your amount saved up was less than $1000 per year, which is manageable for your middle class family to pick up the tab, so you didn’t change your investment strategy much.

Then in 2008 the infamous Great Recession hit and the State had plummeting revenues. Your child was already in high school, and already planning for college. In response, tuition at University of Washington rose by 13.1. Tuition was now 127% of the prediction you made 16 years ago. In 2010 it rose by 13.1% again, making it 137% of your prediction, and then in 2011 it rose by a whopping 21%, making tuition 158% of the amount you budgeted for based on historical trends.

For the average middle class family to find an additional $500 to cover the cost of college is manageable.

But when you need to pick up an additional $5000 compared to what you planned for, and you were only given two years to prepare, most families don’t have any good options to cover the unexpected increase of tuition in the time allocated to them. The only options left are for their child to work a low income job after high school to save the difference, which delays the time at which they get a professional job which pays them over twice they can make with a high school diploma (on average), which will literally cost them for the rest of their lives, and also reduce the taxes they pay back to society, and reduce their potential retirement benefits which will impact them for the rest of their lives.

The only solution offered by the American government was for the student to take on personal loans which cannot be discharged in bankruptcy. Now if we do the math and the family did everything right and they went with the reasonable prediction when their kid was born we are looking at a difference of almost $19,000 between the amount they allocated for college and the real cost. Assuming they can’t take money out of retirement, the only option left without postponing college is to take out a large amount of student loans.

Dixiecrats are trying to portray this as a fail of “social responsibility” and “you should have worked harder, you lazy Socialist scum” but that’s not what is actually going on. For half a century part of the social contract of being American was pretty similar to other developed countries, and it included ensuring that young adults get a college education which significantly increases life time earnings, extends lifespans, increases taxes paid, and improves the health of those individuals over their lives, saving a ton of money in health care costs.

In 2008 the social contract was broken, and the United States put an unprecedented burden on the middle class, those who are too rich for Pell Grants, yet too poor to simply pull money out of their non-existent retirement funds. The children of these people are far less likely to own homes which for the last two centuries has been one of two ways American families have grown their wealth, the other of course being IRAs. Average American families were planning on the government being their for their children the way the government was there for them when they were young, and then the government just wasn’t.

College is a necessary part of society, and we need everyone who is able to do the work be able to go to college regardless of how much money their parent’s make. Education funding is important because young adults don’t have time to save up for college, and young adults are not in charge of their parent’s financial decisions. Also, in the past people were only able to cover the cost of college because the government was covering a large portion of the bill, as part of the now broken social contract. Because of this, it is the role of everyone in society to ensure that young people are able to improve their lives, and we all benefit when we have a more educated population.

I’m done with higher education, I have earned my degree. My personal student debt load is minimal. I am very lucky, I did work in college as well, and my personal college funding my family prepared for me has nothing to do with my personal work ethic or self-worth. I had no control over that.

We need to rebuild the social contract. College needs to in cost to the point where it is affordable again, and those who are still in high school need to know that they will have a chance.

We also need to do right for those of us who had the social contract broken when we were in high school, especially my peers who didn’t have the luck I had with grandparents who have a good financial advisor who made good decision with them before I was even born. We need college to be accessible to all high school students who are willing and able to do it.

We also need to fix the social contract for my peers who saw the social contract ripped in two in front of their faces when we were in high school. The easiest way to restore the social contract is to pardon student loans. It isn’t a choice between doing right for today’s high schoolers and doing right for college graduates of the last decade, we can do both. Best part of this is the total tax burden for tax payers to pardon student loans is a whopping $0.

For these reasons, we need to restore the social contract and rebuild the American dream.

Pardon student debt.

Reference:

http://depts.washington.edu/opbfiles/web/2016-17%20Tuition%20&%20Fee%20History.pdf

college cost prediction spreadsheet

What comes next

Two things matter right now,

  1. Do Manchin and Sinema support the bulk of BBB (hint, we know they don’t)
  2. Will voting rights be passed

This will determine the next decade. Plain and simple. We have three potential futures which will be determined by these two decisions:

  1. We get only half of BBB and no voting rights (probably our reality)
  2. We get the full BBB and voting rights
  3. We get the full BBB and no voting rights

If Manchin and Sinema allow voting rights to pass (which requires filibuster abolition) we will get the other half of BBB, the thought we will get filibuster abolition, voting rights, and only half of BBB is preposterous. It can be discarded.

Scenario 1

This is probably our reality. Democrats run on around 10% of what Biden promised. Voting discrimination passes in more states, particularly Missouri. Democrats have negligible accomplishments and many of their voters have been removed from voter rolls. Republicans easily win the midterms. Bidens obsession with bipartisanship makes him the least significant President since James Garfield, with no major accomplishments. Republicans win in 2024, eliminating what little progress we made.

Scenario 2

The harsh reality of voter suppression finally means the Biden administration has to face the reality that the filibuster could make him insignificant. He uses his influence to convince Manchin and Sinema to abolish the filibuster and they pass the John Lewis Voting Rights Act. They pass the rest of BBB and democrats run on it next year. With expanded voting rights and a base who isn’t discouraged, the democrats keep their trifecta.

Scenario 3

Democrats have the full BBB to run on. Many POC voters are discriminated against, so democrats underperform. Its really hard for predict who gets congress, but it will be close. Voter discrimination in Georgia, Arizona, and Missouri (which is probably coming) will probably cost the Democrats the Senate.

President Biden, please put more pressure on Manchin and Sinema, they are the only ones holding up your agenda.

Closest Presidential Elections in American History, Part 2-1

What would happen in historic presidential elections if the vote flipped by 1% in each State towards the candidate who lost that state?

In 2020 Georgia, Arizona, and Wisconsin had margins of under 1%. Biden would have lost 37 electoral college votes compared to our reality and won 269 electoral college votes, sending the election to Congress. The Senate had a Republican majority and the House had a Democratic majority, meaning that the 12th amendment comes into effect.

What would have happened then? Well, here is a picture of the partisan majority of each state’s house delegation:

As we can see, Republicans would control the delegations from 26 states, Democrats would control delegations from 22 states, and 2 states had an even number of Democrats and Republicans from each state. 26/50 > 0.5 so that is a majority, and Trump would have won the election.

When it comes to the Vice Presidency, the Senate would vote with each Senator having one vote.

There were 52 Republicans in the Senate and 48 members caucusing with the Democrats, which means that Mike Pence would have been elected Vice President.

 

We seriously need to abolish the electoral college and vote for the President via the popular vote using Instant Runoff Voting. We cannot afford a situation like this, especially considering the damage that can be done by such an archaic broken system.

Closest presidential elections in American history, Part 1

What would happen if you were to take the states which voted for the winner with under 51% of the vote and flip those states to the loser in all historical Presidential elections since Andrew Jackson?

Here’s the answer:

In 2020 Joe Biden won 306 electoral college votes. Arizona, Wisconsin, Georgia, Pennsylvania, Nevada, and Michigan voted for him with less than 51% of the vote. Those six states are worth 79 electoral college votes, which means he would have only won 227 electoral college votes, and Trump would have been reelected.

In 2016 Donald Trump won 304 electoral college votes. Utah, Nebraska’s 2nd, Wisconsin, Arizona, Michigan, Pennsylvania, Florida, North Carolina, and Georgia would have flipped, worth 124 electoral college votes, which would have given him 180 in total, and Hillary Clinton would have been President.

In 2012 Barack Obama won 332 electoral college votes. He only won Florida and Ohio with under 51% of the vote, worth 47 electoral college votes, which would have given him 285 electoral college votes, meaning he won in a landslide.

In 2008 Barack Obama won 365 electoral college votes. He won North Carolina, Indiana, and Nebraska’s 2nd with under 51% of the vote, worth 27 electoral college votes. He would have gotten 338 electoral college votes, and still would have won in a landslide.

In 2004 George W. Bush won 286 electoral college votes. He won New Mexico, Iowa, Nevada, and Ohio with less than 51% of the vote, which would have been 37 more votes for Kerry. Bush would have won 249 electoral college votes and John Kerry would have been President.

In 2000 George W. Bush won 271 electoral college votes. He won New Hampshire, Florida, Nevada, Ohio, Missouri, and Colorado with under 51% of the vote, worth 73 electoral college votes, meaning he would have only won 198 votes and Al Gore would have been President.

In 1996 Bill Clinton won 379 electoral college votes. He won Nevada, Kentucky, Arizona, Oregon, Ohio, Missouri, Tennessee, Florida, Wisconsin, Pennsylvania, New Mexico, New Hampshire, Washington, and Iowa with under 51% of the vote. These add up to 156 electoral college votes, putting him at 223 electoral college votes, and Bob Dole would have been President.

In 1992 Bill Clinton won 370 electoral college votes. He won Nevada, Montana, Maine’s 2nd, Maine, New Hampshire, Maine’s 1st, Colorado, Ohio, Wisconsin, Connecticut, Oregon, New Jersey, Iowa, Washington, Georgia, Minnesota, Delaware, Michigan, Missouri, Kentucky, Pennsylvania, Louisiana, New Mexico, California, Vermont, Rhode Island, Tennessee, Massachusetts, Hawaii, West Virginia, Illinois, New York, and Maryland with under 51% of the vote. He only won 9 votes with over 51% of the vote in 1992. That election was way too close, mostly because of Ross Perot.

In 1988 George H.W. Bush won 426 electoral college votes. He won only Illinois and Pennsylvania with under 51% of the vote, worth 49 electoral votes which would have given him 377 votes. He won in a landslide.

In 1984 Ronald Reagan won 525 electoral college votes, and got over 51% of the vote in every state he won.

In 1980 Ronald Reagan won 489 electoral college votes. He won with under 51% in Massachusetts, Vermont, Maine, Maine’s 1st, New York, Maine’s 2nd, Delaware, Wisconsin, Arkansas, Connecticut, Oregon, Tennessee, Alabama, Michigan, Kentucky, North Carolina, Mississippi, South Carolina, Pennsylvania, his birth state of Illinois, and Washington. These states add up to 226 electoral college votes, which would have given Reagan only 263 and given Carter a second term.

In 1976 James Carter won 297 electoral college votes. He won with under 51% of the vote in Hawaii, Pennsylvania, Mississippi, Wisconsin, and Ohio, worth 74 electoral college votes. If those states had flipped, Ford would have won reelection.

In 1972 Richard Nixon won 520 electoral college votes, and won every state with over 51% of the vote. Too bad he was a rat bastard.

In 1968 Richard Nixon won 301 electoral college votes. He won fewer than 51% of the vote in Tennessee, South Carolina, North Carolina, Florida, Virginia, Kentucky, Missouri, Delaware, Ohio, Alaska, New Jersey, Illinois, Nevada, Oklahoma, California, Wisconsin, Oregon, Indiana, Colorado, and Montana. These states add up to 245 electoral college votes, giving Nixon only 66 electoral college votes if those states had flipped. Wallace really disrupted the election, but if Wallace hadn’t run, they would have voted for Nixon anyways, so Nixon won with a spoiler which took votes from himself. 1968 is a very consequential and complicated year, and the fact that Nixon won while there was a spoiler stealing votes from him is telling of how chaotic that year was. Too bad he was a rat bastard.

In 1964 Lyndon Johnson won 486 electoral college votes, and won only Idaho with under 51% of the vote. He would have won 482 electoral college votes and still won the election. This was the first year Republicans won the South as a bloc since Reconstruction.

In 1960 John F. Kennedy won 303 electoral college votes. He won New Jersey, Illinois, Hawaii, New Mexico, Arkansas, Missouri, Louisiana, Texas, Minnesota, Delaware, and Michigan with under 51% of the vote. These states add up to 139 electoral college votes, which would have given him only 164 electoral college votes and given Nixon the election. Good thing Kennedy squeaked out a win here, because Nixon was a rat bastard.

I really, really hate Richard Nixon, if you can’t tell.

In 1956 Dwight Eisenhower won with 457 electoral college votes. He won only Tennessee with under 51% of the vote, meaning if he lost Tennessee he would have had 446 electoral college votes and still won the Presidency. This was the last year where Republicans won most of the North and Democrats won the Solid South.

In 1952 Dwight Eisenhower won with 442 electoral college votes. He won Tennessee, Missouri, and Rhode Island with under 51% of the vote, worth 31 electoral college votes, meaning if he had lost those he would have won 409 electoral college votes and still won the Presidency.

In 1948 Harry Truman won with 303 electoral college votes. He won California, Virginia, Florida, Tennessee, Ohio, Idaho, Illinois, Iowa, Nevada, and Wisconsin with under 51% of the vote, worth a combined 137 electoral college votes, which mean if he lost those state he would have only won 166 electoral college votes and Dewey would have been President.

In 1944 Franklin Roosevelt won 432 electoral college votes. He only won Michigan and New Jersey with under 51% of the vote, worth a combined 35 electoral college votes. If those states flipped President Roosevelt would have still won 398 electoral college votes and the Presidency.

In 1940 Franklin Roosevelt won 449 electoral college votes. He only won Wisconsin and Illinois with under 51% of the vote, worth a combined 41 electoral college votes. He would have still won 408 electoral college votes, and the Presidency.

In 1936 Franklin Roosevelt won 523 electoral college votes. He only won New Hampshire by under 51%, which means that if New Hampshire flipped he would have won 519 electoral college votes and the Presidency.

In 1932 Franklin Roosevelt won 472 electoral college votes. He only won New Jersey, Ohio, and Massachusetts with under 51% of the vote, worth 59 electoral college votes, which means if those three states flipped he would have won 413 votes, and still won handily.

In 1928 Herbert Hoover won 444 electoral college votes. He only won New York with under 51% of the vote, worth 45 electoral college votes, meaning if New York had flipped he would have won 399 electoral college votes and still won the election.

In 1924 Calvin Coolidge won 382 electoral college votes. He won less than 51% of the vote in Arizona, Nevada, Montana, Maryland, Nebraska, Idaho, North Dakota, New Mexico, Kentucky, Utah, West Virginia, Missouri, and South Dakota worth 86 electoral college votes. If those state flipped he would have won 296 electoral votes and still won the Presidency.

In 1920 Warren Harding won 404 electoral college votes. He only won Oklahoma with less than 51% of the vote, which means if Oklahoma had flipped he would have still won the Presidency with 394 electoral college votes.

In 1916 Woodrow Wilson won 277 electoral college votes. He won California, North Dakota, Washington, New Hampshire, Kansas, New Mexico, Missouri, and Oklahoma with under 51% of the vote, worth 70 electoral college votes. If those states had flipped Charles Evans Hughes would have been elected.

1912 was a weird election, to say the least, because it was the last time where a former President ran as a third party candidate. It was also the last time where a third party came in second place for both electoral college votes and the popular vote. It is also the last time a socialist candidate got over 5% of the vote. If we had used ranked voting, it is reasonable to assume that Theodore Roosevelt would have won a third term. I’m going to leave this election out because its complicated and deserves its own post.

In 1908 William Howard Taft won 321 electoral college votes. Taft won fewer than 51% of the vote in Montana, Indiana, Missouri, and Maryland, worth a combined 38 electoral college votes. If those 4 states had flipped he would have won 283 electoral college votes and still won the election.

In 1904 Theodore Roosevelt won 336 electoral college votes. He won less than 50% of the vote in Missouri, worth 18 electoral college votes, which would have given him 318 electoral college votes and he still would have won the election. I’m ignoring the 7 faithless electors in Maryland.

In 1900 William McKinley won 292 electoral college votes. He won under 51% of the vote in Nebraska, Utah, and Indiana. These states were worth 26 votes, which would have given him 266 electoral college votes. 224 electoral college votes were needed, and he still would have won the election.

In 1896 William McKinley won 271 electoral college votes. He won under 51% of the vote in Kentucky, California, Oregon, and Indiana. These states were worth 39 electoral college votes. If those 4 states flipped he would have won 232 electoral college votes, more than the 224 electoral college votes needed in order to win, so he still would have won.

In 1892 Grover Cleveland won 277 electoral college votes. He won under 51% of the vote in New Jersey, Connecticut, Delaware, Missouri, West Virginia, New York, Illinois, Michigan 10, Michigan 5, Wisconsin, Michigan 2, Indiana, North Carolina, Michigan 7, and California. These states were worth a combined 152 electoral college votes, he would have won 125 electoral college votes, and Benjamin Harrison would have won his reelection.

In 1888 Benjamin Harrison won 233 electoral college votes. He won under 51% of the vote in Indiana, New York, Ohio, Illinois, California, Michigan, Wisconsin, and New Hampshire, worth a combined 132 electoral college votes. If those states had flipped he would have won 99 electoral college votes and Grover Cleveland would have won his reelection.

In 1884 Grover Cleveland won 219 electoral college votes. He won under 51% of the vote in New York, Connecticut, New Jersey, Indiana, and West Virginia, worth a combined 72 electoral college votes. If those states had flipped James Blaine would have won.

In 1880 James Garfield won 214 electoral college votes, he needed 185 in order to win. He won Indiana, New York, Oregon, Connecticut, and Pennsylvania with under 51% of the vote. Those states were worth 88 electoral college votes. If those states had flipped Winfield Hancock would have become President.

In 1876 Rutherford Hayes won with 185 electoral college votes, the minimum he needed in order to win. 1876 was the closest election in American history in terms of electoral college votes. He won under 51% of the vote in Illinois, Ohio, South Carolina, Wisconsin, Pennsylvania, California, Oregon, and Florida. If any of those states had flipped Samuel Tilden would have become President.

1872 was a very unusual election because Horace Greeley died on November 29, 1872, before the Electoral College met. Grant would have likely won no matter what.

In 1868 Ulysses S. Grant won 214 electoral votes, he needed 148. He only won California with under 51% of the vote, and California was only worth 5 electoral college votes that year, so he won in a landslide.

In 1864 Abraham Lincoln won 212 electoral college votes, he needed 118. He only won New York with under 51% of the vote, worth 33 electoral college votes. He won in a landslide.

In 1860 Abraham Lincoln won 180 electoral college votes, he needed 152 in order to win. He won with under 51% of the vote in California, Oregon, New Jersey, and Illinois, worth a combined 22 electoral college votes. If those 4 states had flipped Lincoln would have won 158 electoral college votes and still won the election. 1860 is unusual in how President Lincoln won under 50% of the popular vote, yet would have still won the electoral college in our scenario.

In 1856 James Buchanan won 174 electoral college votes, he needed 149 in order to win. He won under 51% of the vote in Illinois, New Jersey, California, Pennsylvania, and Indiana, worth 62 electoral college votes. If Illinois, New Jersey, Pennsylvania, and Indiana had voted for John C. Fremont and California had voted for Millard Fillmore, (the runner ups in those states) Buchanan would have had 108 electoral college votes, Fremont would have had 172 electoral college votes, and Millard Fillmore would have had 12 electoral college votes, giving Fremont the Presidency.

In 1852 Franklin Pierce won 254 electoral college votes, he needed 149 in order to win. He won less than 51% of the vote in Ohio, Connecticut, Delaware, New York, Iowa, North Carolina, Michigan, and Maine. Those states were worth 95 electoral college votes. If those states had flipped Franklin Pierce would have won 159 electoral college votes and still won.

In 1848 Zachary Taylor won 163 electoral college votes, he needed 146 in order to win. He won with less than 51% of the vote in Massachusetts, New York, Vermont, Connecticut, and Pennsylvania, worth a combined 86 electoral college votes. If those states had flipped to their runner up, 44 votes would have gone to Martin Van Buren, and 6 votes would have gone to Lewis Cass. Taylor would have had 77 electoral college votes, Cass would have had 133 electoral college votes, and Martin Van Buren would have had 44 electoral college votes. No candidate would have had a majority in the electoral college and the election would have been determined by Congress following the rules in the 12th amendment.

In 1844 James K. Polk won 170 electoral college votes, he needed 138 in order to win. He won with less than 51% of the vote in New York, Michigan, Indiana, and Pennsylvania, worth 79 electoral college votes. If those states had flipped Henry Clay would have been President.

In 1840 William Henry Harrison won 234 electoral college votes, he needed 148 in order to win. He won with under 51% of the vote in Pennsylvania and Maine which were worth 40 electoral college votes, and if those states had flipped he still would have won.

In 1836 Martin Van Buren won 170 electoral college votes, he needed 148 in order to win. He won with under 51% of the vote in Connecticut, worth 8 electoral college votes. He would have won if Connecticut had flipped.

In 1832 Andrew Jackson won 219 electoral college votes, he needed 145 in order to win. He won under 51% of the vote in New Jersey, worth 8 votes, so he would have won no matter what.

In 1828 Andrew Jackson won over 51% of the vote in every state he won, so he won in a solid landslide.

I’m not going to look at elections before 1828 for two reasons.

  • 1824 was a batshit crazy election (technically)
  • Very few states had a popular vote before 1828.

The years which would have flipped if the states which voted for the President elect with under 51% of the votes had flipped to the major opponent were:

  • 2020
  • 2016
  • 2004
  • 2000
  • 1996
  • 1992
  • 1980
  • 1976
  • 1968
  • 1960
  • 1948
  • 1916
  • 1892
  • 1888
  • 1884
  • 1880
  • 1876
  • 1856
  • 1848 (no one would have won over 50% of the Electoral College)
  • 1844

The only Presidents which would have still won the election if their opponent picked up all states he won less than 51% of the vote in, won their party’s nomination after being President (if possible, if they run), and won every election he ran as the Presidential candidate in the general election, for are:

  • Barack Hussein Obama Jr.
  • Lyndon Baines Johnson
  • Dwight David Eisenhower
  • Franklin Delano Roosevelt
  • Calvin Coolidge
  • William McKinley
  • Ulysses S. Grant
  • Abraham Lincoln
  • Andrew Jackson

 

Damn, that’s a lot of data and a long story. What do I take away from this story?

  • Both parties can win elections.
  • Incumbency advantages are very real.
  • Most elections in recent history have been close.
  • The only President to win with enough support that if he lost 1% support in every state he still would have won in the last 30 years was President Obama.
  • While we often paint the election as relying on one or two states, this is usually not the case.
  • Only 4 Presidents have won with enough support in enough states to win with only states they won with over 51% of t he vote in over the last century. Most Presidents have had technically close elections.

The end of legal abortion, how we got here

The year was 1972, and the Supreme Court decided 7-2 with a bipartisan majority that abortion was legal. Since this point in time, the majority of Americans have continued to support abortion rights up to the present day. when asked whether we are pro-life or pro-choice, Americans are split, but when asked whether people believe abortion should be banned in all circumstances, almost no one actually believes that. The percentage of Americans who oppose abortions in all circumstances remains extremely low to this day.

While abortion has strong support as long as you don’t ask the question in politically charged language, there is a loud vocal minority of around 30% of Americans who have used the Republican Party to accomplish their goals of making abortion illegal. Over the last 50 years the Supreme Court has had a consistent Conservative majority, but there have been times where it almost got a Liberal majority, particularly in 2016 where if President Obama had been able to appoint the successor to Antonin Scalia, it would have been the first time we had a liberal majority on the Supreme Court since the Civil Rights era.

That future of course didn’t occur, and Trump got 3 appointees to the Supreme Court. with 3 justices appointed by Trump, 2 justices appointed by George W Bush and 1 appointee by George H W Bush there are 6 Republican appointees. If our current Supreme Court Justices vote in the same way they voted in Whole Woman’s Health v. Heller, here is what we will likely see:

Voted In Favor of abortion rights: Breyer, Sotomayor, Kagan
Voted against abortion rights: Thomas, Alito, Roberts

There are then 3 justices who were appointed by Donald Trump, 2 of them need to vote to uphold the new law in Texas and Roe v Wade will be repealed. There are no signs that any of Trump’s appointees are going vote in favor of abortion rights, based on previous cases. (NPR)

If Clinton had been elected, we would have either had a 3-3 split at the Supreme Court, or if we had managed to take the Senate in 2018 in that timeline, we would now have a 6-3 Democratic majority in the Supreme Court.

However, this is not the case. We got here because people saw the wife of the man who appointed Stephen Breyer and Ruth Bader Ginsburg as too moderate, and because of this, and only this, we are likely going to see abortion be made illegal again in the next few weeks.

This is really simple stuff.

References:
https://en.wikipedia.org/wiki/Abortion_in_the_United_States#Public_opinion
https://www.npr.org/2021/10/22/1047619075/the-supreme-court-keeps-texas-abortion-law-in-place-but-agrees-to-review-it

Tax carbon, finance transit

So as I was sitting down tonight I was thinking about why I generally support taxing carbon versus spending our way out of climate change, while at the same time I favor financing transit over making it expensive to drive in cities.

Now the first argument is fairly easy. Taxes and subsidies are essentially the same thing at their fundamental basics, and if your goal is to reduce the consumption of a bad (eg oil) then a tax is a very direct policy which will reduce the negative impact which you are trying to fight. If you try to subsidize and alternative when your real goal is to reduce something which is bad, then you could potentially end up having the substitution effect reduce consumption of something else. I’ve written about this before, and the classic example is how when Germany cut nuclear power, coal power increased. A carbon tax wouldn’t have such a perverse outcome.

While a subsidy for renewables will almost certainly reduce some of the demand for fossil fuels in our current economy, it will never reduce the demand for fossil fuels as much as a carbon tax. I don’t even necessarily support spending a carbon tax to finance a renewable energy subsidy unless if that renewable energy subsidy’s cost per metric ton of carbon reduction is greater than that of increasing the carbon tax by the same amount.

For this reason, it is almost always wiser to spend the carbon tax on other problems facing our society because the substitution effect can never be fully controlled, and if subsidizing solar means we get less wind power being built, then that marginal cost is a waste of money which would have been better spent somewhere else.

When it comes to increasing transit use however, couldn’t we just tax the living hell out of driving? Let’s look at various taxes we could do:

  1. If you use a carbon tax or a gas tax, people will switch to electric cars. While this is a net benefit for the environment, it didn’t do the main goal of moving people towards transit use.
  2. You can put in tolls. The issue here is that you are not going to toll every road, which means wherever is not tolled is going to still have a lot of private traffic. Toll avoidance is also a very real thing. I-90 is tolled in Chicago, so many people who can go around I-90 will instead take  I-294 which is not tolled. The only way to reduce total car usage through tolls is zone-based pricing, where an entire region becomes tolled to enter or drive within a transit area. Some of these people however might be making trips at all, which costs local businesses customers, and will inevitably reduce tax revenue to local governments from those transactions.
  3. If you simply put in a tax without expanding transit, you are simply raising revenue. The private sector is not going to provide bus service and taxis are not as efficient as buses. The fares for private sector transit will have to be less than the cost of an electric vehicle over the long term in order to cut transit.
  4. Most people in most places are not going to give up their cars completely. This means you are working within the margin, and you need to think about the margin. Fixed costs such as purchasing a vehicle, and insurance are not going to impact people’s decisions on whether they use transit or drive their car day to day. People are intrinsically comparing the marginal costs (time and money) of driving vs the marginal costs of using public transit for that single trip, and that margin is all you have to work with. Unless if you have a policy which acts on the margin of a person’s decision, that policy is going to fail. This means that each trip has a very small amount of room to work with, and you need to make sure that the overall cost of a transit trip in time and money is less than the cost of driving.
  5. Increasing the cost of driving without increasing transit funding will inevitably lead to fewer overall trips, which hurts the local economy. Increasing transit funding can help expanding service or lowering fares, both of which help increase overall transit use. People who are in a different neighborhood are more likely to eat at a restaurant, where they will pay sales taxes, and increase corporate taxes owed, which benefits the government. For these reasons, it is in the best interest of governments when reducing congestion to focus not just on reducing car use, but also to increase transit use in order to help the local economy.

One should only increase the cost of driving if reducing car usage is your main intention.

The main difference between climate change and expanding use of transit is that one is trying to end one very clear problem. If you are trying to end something bad, a tax is your obvious policy.

Expanding the number of people who use transit is the opposite problem, so it requires the opposite solution, which is a subsidy.

It’s just that simple.

That being said, if the goal is to both reduce car usage and increase transit usage, the government could choose to both tax car use through parking fees, tolls, and other mechanisms which will reduce driving in conjunction with reducing fares or improving service which will increase transit use without harming local jobs. This joint policy has the benefit that it guarantees car usage will decline and transit use will increase, and is a good idea.

But if I had to choose between only one policy to increase transit use, the subsidy will always be more efficient.

References:

Pricing Strategies and Their Effect on Public Transportation – US DOT