.. title: The lottery as a rational investment. .. slug: BB938 .. date: 2010/11/12 00:47 .. tags: nerdness, Writing .. category: .. link: .. description: .. type: text .. author: .. en: .. priority: .. updated: 2010/11/12 00:47 .. url_type: There is a prejudice that the poor play lotteries because they are lazy, can't save and are generally stupid and are hurting themselves by chasing the fantasy of winning instead of saving pennies. You know what? It's bullshit. When I was in high school (about 13 years old), I once had a plan to make money: I would play the lottery. Here's the mechanism I had in mind. I would play $1 in the quiniela. Quiniela pays $700 for each $1 you bet, and you have to choose a number between 000 and 999. My idea was: I can bet the $1 my parent give me every day, and there's a chance I make $700. If I had $700 I could buy anything a 13-year old kid may want. With $1? Not so much. Of course you are right now thinking: What a moron! He has a 0.001 chance of winning and it pays 700 to 1, so it's a losing bet! Bzzzzzt! Let's start with some simple simulation code: .. code-block:: python import random n = 476 for tests in range(10000): for w in range(1000): q = random.randint(0,999) if n == q: break print(w) Short explanation: run 10000 simulations of this process: * We play each day for 1000 days. * If we win, we stop. * If we don't win in 1000 days we stop. * We record the number where we stop. So, I ran it. Here's a graph of the results .. raw:: html histogram So, how many never won anything? In my data set: 3699 players out of 10000 never won anything. How many actually *lost* money? 5030 players. And how many *won* money? 4967 players won money. 2910 players won in less than 350 plays. 3 players got exactly even money, winning in their 700th play. For them, this was exactly the same as saving their money. So, is it a good idea to play a lottery like this? It's a coin toss. Half the time, you end with no money. Half the time, you end with more money than if you had saved. If you are betting disposable income (a sufficiently low amount that "it doesn't hurt"), it works out. You have a fair chance (50%) of a reward at least as good as saving the money, and a decent chance (25%) of a reward twice as good. And you have a fair chance (50%) of losing money. But you would lose it very, very slowly and painlessly. ¿How well do you think stocks compare to that? ¿And what are the barriers to entry on both games? In short: playing the lottery is not irrational, really, it's just a savings plan. It sure was a better idea than buying candy!