Friday, July 15, 2011

Real Lottery and Blackjack

I promised to take requests on blog posts, so this post will be on Ann's comment on the lottery raising its prices. First of all my opinion on the lottery is that it is a tax on the mathematically challenged. My chances of winning the jackpot are about the same whether I purchase a ticket or not. 

When the jackpot is large enough ($323 million) the "break-even point" is the point where the expected return matches the amount invested. That is, if you bet $2, you could expect to win $2 back. The way the expected return is calculated is:

Return= P(winning $3) * 3 + P(winning $4) * 4 +.....+P(winning jack) *jackpot total

The "break-even point" needs to be put in quotations, however, because it is far from breaking even. When the jackpot gets large, the probability of multiple winners increases. Also, you can plan on giving about 40% of those winnings back in taxes. Finally, the posted jackpot is paid over 30 years, so comparing the value of the $2 invested in the ticket to the value of the payout in 30 years is not a fair comparison. Basically, even after paying for operating expenses (advertisements, lottery retailers, bureaucrats, etc) the government still keeps fixed portion of winnings as profits. Plus they get a major kickback on the taxes that come back from the big winners. If the winner plans to choose the cash option the expected return is also negative. Basically, even in the best conditions this is a losing game. Other people have spent much more time than I am willing on the expected returns of the lottery. This one seems ok. I have bought one lottery ticket in my life (the day I turned 18) and don't plan to buy another one ever. As far as the implications of raising the price, my guess is the expected return per dollar will stay roughly the same. This means you can expect to lose twice as much if you buy the same number of tickets.

As you can tell I have very little interest in lottery tickets. I can say, however, that I have had an ok time playing blackjack at the casinos. Individually, the chances of winning money at the casino are much higher than with lottery tickets. You should still definitely plan to lose money when you go to the casino, but at least at the casino you can think of your losses as entertainment.



Now, I can count the number of times I have gone to the casino on one hand (alright maybe two hands), but one thing I do know is you should plan to bring a decent amount of money if you want to play for even an hour. When I went with my freshman corridor my friend and I each brought $20. He played four hands, and I played eight hands before being wiped out. So we were left with drinking the free sodas for about 3 hours until the rest of the group was ready to head back to campus.

Unless you count cards (illegally) playing blackjack perfectly by the book gives you about a 49.5% chance of winning. Most players aren't good enough to play perfectly by the book, so their chances of winning are around 40%. So, if you want to play blackjack for an hour, how much money should you bring to the casino to give yourself a 95% chance that you won't be cleaned out after an hour? To answer this, I simulated going to the casino 100,000 times and take the lowest dollar amount won over a one hour period. I assume 5 people a table= 70 hands per hour, and also you make only the minimum $5 bet per hand. The Money Needed column is how much money you should bring to be 95% sure you can play for the amount of time specified in the Hours Played column.


Good Player (49.5% of winning) Average Player (40% of winning)
Hours Played Money Needed Prob of Winning Money Needed Prob of Winning
1 80 0.417 140 0.034
2 120 0.42 240 0.007
3 150 0.415 330 0.001
4 175 0.409 420 0
10 2900.381 920 0
100 1120 0.198 7705 0


If you don't know if you are a 49.5% or 40% player, you are likely a 40% player. So if you are an average player you can get 3 hours of entertainment and be quite confident it won't cost you more than $330! You should expect to lose about $210. For about that same price I could be catered in the Champions Club at a Twins game, but I wouldn't have a 0.1% chance of making money. I think I would still choose the Champions Club.

Wednesday, July 6, 2011

Timberwolves lottery curse

The reason I was inspired to start writing this blog came a few days before the NBA draft lottery. I woke up to see the twins currently had the worst record in all of baseball, the timberwolves finished with the worst record in the NBA, and vikings were planning to start a rookie quarterback on an already mediocre vikings team. I thought this might be the year we end up with the first pick in the NFL, MLB, and NBA drafts. I started writing an email to some of my friends with calculations on all three events happening this year, and thought this is ridiculous. If I am going to make this calculation I should at least share it with the rest of the world.

Anyway, since then the timberwolves ended up getting the second pick and twins have at least shown signs of sporadic improvement. So instead of that post, I will focus on what many have said is a "curse" for the timberwolves. That is, since the team began in 1989 the timberwolves have never once moved up to a better draft position than they were supposed to. Since we have ended up with the draft position exactly what we were seeded to have on a few occasions, we can't say we always drop. So for the sports writers who say our streak continued this year was completely trivial. Of course the streak continued, we had the top seed, dummy!

But, that still doesn't explain 22 years of draft history without moving up once. After accounting for the Joe Smith debacle, the years we didn't have a lottery pick because we actually made the playoffs, and the one lottery pick we got via trade (Ricky Ricky Ricky), we have had a total of 16 lottery picks.



Lottery History
Since 1990 the number of teams eligible for the lottery has increased from 11 to 14. Teams are assigned some probability of winning based on their regular season record. Once the first 3 spots have been determined, there is no longer any randomness. The team with the top seed that doesn't yet have a pick automatically receives the 4th pick. This continues until all 14 teams are assigned a draft spot. Therefore, if a team doesn't get a top three pick they automatically move down or stay the same. Also, not all teams in the top three picks will necessarily move up either. When you think about it that way, the probability of moving up is not that great for any team. Here are the probabilities of moving up from all 14 seeds in the 2011 draft.



Seed Probability of moving up
1 0
2 0.199
3 0.313
4 0.378
5 0.291
6 0.215
7 0.151
8 0.1
9 0.061
10 0.04
11 0.029
12 0.025
13 0.022
14 0.018



From this, we can see it certainly isn't equally likely to move up or down. Your chances of moving up is also very dependent on what your seed is. At this point, I am going to wave my hand and ask you to trust me on these calculations for the Timberwolves draft history. I will include a technical section at the end if you wish to verify my work.






Year Seed Probability of Moving Up Pick
1990 5 0.3329221 6
1991 7 0.23970483 7
1992 1 0 3
1993 2 0.1515 5
1994 3 0.3281 4
1995 3 0.36 5
1996 5 0.2589 5
1997 no lottery 0
1998 no lottery 0
1999 5 0.2949 6
2000 no lottery 0
2001 no lottery 0
2002 no lottery 0
2003 no lottery 0
2004 no lottery 0
2005 14 0.0181 14
2006 6 0.1828 6
2007 7 0.183 7
2008 3 0.2804 3
2009 2 (From Washington) 0.178 5
2009 5 0.2549 6
2010 2 0.199 4
2011 1 0 2




These probabilities come from this site (sort of), but whoever did the site clearly has the probabilities wrong from 1990-1994. Anyone know why?......write a comment! From 1994-2009 I checked his or her work and they seem ok. The moral of the story is,

1. Each year it is more likely the Timberwolves will not move up in the draft.
2. They have been getting unlucky, but not that unlucky. The probability that in the 16 lotteries that the T-wolves would never move up is about 2.2%. Britt's great uncle Fritz was struck by lightning twice (Probability 0.0000000001625%)... Seriously. I would say crazier things have happened than the Timberwolves failing to move up for 16 drafts.  
3. Never moving up is a bummer, but we should have only expected to move up in about 3 drafts by now.
4. If we didn't finish dead last we would have had a much higher chance of moving up in the draft.


Anyway, thanks for reading. Most of you can safely stop reading at this point unless you care about checking my work.


Technical Portion

Let D1 be a random variable defined by the the team that wins draft position 1. D2 position 2 and so on. Let t be in {1,2,...14} if there are 14 eligible teams in the draft. Let b_t be the number of balls seed t has in pot. Then, for example

P(D1=1) = b_1/ sum_{t=1}^14 b_t
P(D2=1) = P(D2=1|D1=2)P(D1=2) + P(D2=1|D1=3)P(D1=3) +...+ P(D2=1|D1=14)P(D1=14)
P(D3=1)= P(D3=1|D1=2,D2=3)P(D2=3|D1=2)P(D1=2)+ ...+P(D3=1|D1=13,D2=14)P(D2=14|D1=13)P(D1=13)
This needs to be summed for all D1 and D2 pairs that are not equal to each other. I won't spend a ton of time writing this out, because if you can follow this you should be able to see what this looks like via these two R function.




balls2=c(250,199,156,119,88,63,43,28,17,11,8,7,6,5)



##calculates probability of getting second pick for any seed
pballs=c()
calc=function(seed){
set=(1:length(balls2))[-seed]
for(i in set){
pballs[i]=balls2[i]/(sum(balls2)-balls2[i])
}
ans=sum(pballs[set])*(balls2[seed]/sum(balls2))
return(ans)
}

##calculates probability of getting third pick for any seed
pballs2=matrix(NA,length(balls2),length(balls2))
calc2=function(seed){
set=(1:length(balls2))[-seed]
for(i in set){
for(j in set){
pballs2[i,j]=(balls2[seed]/(sum(balls2)-balls2[i]-balls2[j]))*(balls2[i]/(sum(balls2)-balls2[j]))*(balls2[j]/sum(balls2))
}
}
diag(pballs2)=NA
ans=sum(pballs2[!is.na(pballs2)])
return(ans)
}


You can check your results on the wikipedia draft lottery page.