Evolutionary Prisoner’s Dilemma sim

This is a small programming project I worked on in 2013-2014.  Although I wrote a blog series about it at the time, this is not a repost of that series.  Instead, this is a repost of the explanation I wrote earlier this year, when I uploaded the project to github.  If you liked this article, you might also enjoy this interactive game, although I had nothing to do with that one.

The Prisoner’s Dilemma is an important concept in game theory, which captures the problem of altruism. Each of the two players chooses to either cooperate or defect. Cooperating incurs a personal cost, but benefits the other player. If both players cooperate, then they are better off than if they had both defected. In a single Prisoner’s Dilemma, it seems that it’s best to defect. However, if there are multiple games played in succession, it’s possible for players to punish defectors in subsequent games. When multiple games are played in succession, it is called the Iterated Prisoner’s Dilemma (IPD).

The best approach to the IPD is highly nontrivial. In 2012, William Press and Freeman Dyson proved that there is a class of “zero-determinant” strategies that seem dominant, and which would lead to mostly defection. However, Christoph Adami and Arend Hintze showed that the zero-determinant strategies are not dominant in the context of evolution. Understanding this issue could elucidate why humans and other creatures appear to be altruistic.

How the simulation works

  1. We have a population of 40 individuals. Each individual has 4 parameters that govern how they play IPD.
  2. Each individual plays IPD against 2 other individuals in the population, and their fitness is calculated from their average score.
  3. One individual dies, and another reproduces. The probability of reproduction increases with fitness, and the probability of death decreases with fitness.
  4. All the parameters of the individuals are mutated by small amounts.
  5. Steps 2-4 are repeated a million times. Each repetition is called a “generation”.

[Read more…]

A toy model of media economics

One thing I’m interested in is the theoretical economics of entertainment media. For instance, we know that people have a wide variety of tastes in movies, but movie producers aren’t necessarily interested in catering to everyone’s tastes, they’re just interested in maximizing profit. You can imagine situations where this would lead most movie producers to cater to the most popular tastes, and to ignore fringe tastes.

Economists would describe this system as a kind of monopolistic competition. The problem is, monopolistic competition is super complicated and dependent on details, and I for one don’t understand it. So in order to better understand monopolistic competition, I want to build a toy model–the very simplest model that vaguely resembles monopolistic competition. The goal is not to build a realistic model, it’s more of a conversation piece.

Disclaimer: I have no education in economics, I’m more of a game theory guy.

Movies, democracies, and food trucks

Monopolistic competition is a system where different firms produce goods that are differentiated from each other. To make the very simplest model, we’re going to imagine that goods are differentiated from each other along only a single axis. For example, suppose that each movie falls along a one-dimensional spectrum from “drama” to “comedy”. And where a movie falls along this spectrum is the only thing that could differentiate it from other movies. Some viewers prefer comedies, and some prefer dramas, and some prefer dramedies.

[Read more…]

Sexual economics, a theory in need of reworking

This is a repost of an article I wrote in 2015.  It’s just some good old-fashioned making fun of pseudoscientific nonsense.

Recently, my attention was caught by the idea of the “sexual marketplace”.  Specifically, there’s a theory of sexual economics created by Baumeister and Vohs.  If you’d rather not read the paper, the Austin Institute* made a fancy video about it:

*Apparently, it’s a think tank run by Mark Regnerus.  Yes, that Mark Regnerus.

[Read more…]

An altruistic Prisoner’s Dilemma

This is a repost of an article I wrote in 2015, with a short postscript added.

Jeff Kaufman talks about an ethics trade that he sometimes does with a friend.

I have a friend who is vegan for animal welfare reasons: they don’t think animals should be raised for food or otherwise suffer for our benefit. On the other hand, they used to really enjoy eating cheese and miss it a lot now that they’re vegan. So we’ve started trading: sometimes I pass up meat I otherwise would have eaten, and in exchange they can have some cheese.

This is a win-win for the vegan, since they get to have some cheese, and there is no net harm to animal welfare.  It is not clear what’s in it for Jeff though, except for his idiosyncratic preference to have such trades.  I am not sure this is an interesting scenario by itself, since, in general, any trade is possible with sufficiently idiosyncratic preferences.

Therefore, I propose a similar scenario, which I’ll call the vegan/omnivore dilemma.

[Read more…]

Homeownership sure seems like a bad investment

It’s said that homeownership is one of the markets that millennials are killing. Well color me a typical millennial, because I don’t own a house, and I can’t see why I would want to. Renting housing just seems like a better deal. I’m going to explain why I have this intuition, then I’ll actually do some research to see common rebuttals.

Similarities and differences

Let me start with some caveats and basics.  While homeownership and renting fulfill the same need, they are not directly comparable. At least around here, if you rent housing then you tend to get a smaller apartment, and if you buy housing, you tend to get a larger house. If you want to spend more money for more space, or less money for less space, that may make your decision for you.

The other main difference is that homeownership is kind of a two-for-one deal. If you rent housing, you’re pretty much paying money for living space, and that’s it. If you buy housing, you’re not just paying money for space, but also investing some of that money. If you don’t want to invest money (say you can’t afford to), then homeownership is a bad deal for you. If you do want to invest money, then you could buy a house, but it’s not like that’s your only option. You could just rent housing, and then invest the money you saved by not buying a house. Thus, the comparison I’m making is not between a house that you own, and a house that you rent. The comparison is between investing in a house, and investing in, say, an index fund.

[Read more…]

Niall Ferguson, queer theory, etc.

Niall Ferguson, a conservative historian, was recently in the news because schadenfreude. This started a train of thought to far away places, and I’d like to take you on the journey.

In The Stanford Daily‘s coverage of said schadenfreude, they mention another time that Ferguson put his foot in mouth, back in 2013. Ferguson had claimed that the famous (liberal) economist John Maynard Keynes didn’t care enough about the future because he was gay and childless.

Point in fact, Keynes was bisexual, married a woman, and tried to have children, although they had a miscarriage. Also, it’s not clear that Keynes didn’t care about the future.

Niall’s remark was clearly in response to Keynes’ famous quote, “In the long run we are all dead.” I immediately saw the connection, as this is a household quote and in-joke between me and my fiance. We say stuff like, “That may help in the long run, but you know what they say about the long run.” But it’s not really an expression of disregard for the future. It would help to see the quote in its original context: [Read more…]

Is grad school doing what you love?

Many people place a special value on “doing what you love”. Should you become a corporate tool, or a real-life scientist? “You should do what you love” is the reply. And it’s a reply that is detached from any real cost-benefit analysis. Like, maybe you only sorta love being a real scientist, and maybe you don’t love the working conditions of a scientist, and maybe the salary of a corporate tool is so much higher that it enables you to do other things that you love. But you can’t make a snappy motto out of such considerations.

The problem with “doing what you love” is that it doesn’t come for free. If academic institutions need a certain number of grad students,* then they need to provide incentives for just enough people to apply. “Doing what you love” is one incentive, and it takes the place of other incentives that academic institutions could have offered instead. In other words, they don’t need to pay you well, or treat you well. However much grad students are willing to tolerate in order to do what they love–that’s how much they end up having to tolerate.

*I’m only talking about Ph.D. students and not Masters students. I’ve never heard anyone describe a Masters degree as doing what you love.

In economic terms, we can speak of the “marginal” grad student (a concept similar to the “swing voter”). For the marginal grad student, the expected costs and benefits are exactly equal, such that the decision to go to grad school could go either way. It may be that the marginal grad student thinks they would love being a scientist, but this is exactly offset by the costs. So for some people, grad school may be a good deal. But the deciding factor is not merely whether you love grad school, it’s whether you’d love it more than the marginal grad student.

Beyond that, I think even the marginal grad student is getting a bad deal. The marginal grad student expects they would love grad school, but ends up loving it less than they predicted.

[Read more…]