Smith is in jail and has 1 dollar; he can get out on bail if he has 8 dollars. A guard agrees to make a series of bets with him. If Smith bets A dollars, he wins A dollars with probability .4 and loses A dollars with probability .6. Find the probability that he wins 8 dollars before losing all of his money
(a) he bets 1 dollar each time (timid strategy).
This is difficult to calculate analytically because I can’t create a probability tree. Even if Smith only needed three dollars to win, the probability tree would be infinite in size because with some infinitesimally small probability he just wins and loses the second dollar over and over again. Instead I’ll model the guard’s game stochastically.
bet <- c(1,1,-1,-1,-1)
losses <- 0
wins <- 0
sims <- 10000
for(x in 1:sims) {
bal = 1
while (bal > 0 & bal < 8) {
bal <- bal + sample(bet, size=1)
if (bal == 0) {
losses <- losses + 1
} else if (bal == 8) {
wins <- wins + 1
}
}
}
print(paste0("The number of wins: ", wins))
## [1] "The number of wins: 208"
sprintf("For a win rate of: %1.2f%%", 100*wins/sims)
## [1] "For a win rate of: 2.08%"
I’ve run this model several times and it usually comes up with a value around 2%. As an improvement I could have the code chunk run the 10k simulations 10 times and provide the average win rate.
(b) he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).
This is easy to calculate analytically because at every step if Smith loses it’s game over.
In the first step he bets 1 and wins 1 (40% chance) or loses everything and it’s game over.
In the second step he bets 2 and wins 2 (40% chance) or loses everything and it’s game over.
In the third step he bets 4 and wins 4 (40% chance) and is able to pay bail or loses everything and it’s game over.
The probability of paying bail by winning three times in a row, betting everything, is 6.4%
.4*.4*.4
## [1] 0.064
(c) Which strategy gives Smith the better chance of getting out of jail?
The bold strategy at 6.4% compared to the timid strategy’s ~2%.
However if I change the probability of winning each bet from 40%, which strategy wins changes. At 50% they appear about the same. At a 60% win-rate the timid strategy is superior, presumably because you have more chances for expected value to work in your favor.
Chance <- c("40%", "50%", "60%")
TimidStrategy <- c("~2%", "~12.5%", "~34.4%")
BoldStrategy <- c("6.4%", "12.5%", "21.6%")
df <- data.frame(Chance, TimidStrategy, BoldStrategy)
library(knitr)
kable(df, caption = "Strategy Win Rates Over Different Chances to Win a Bet")
Chance | TimidStrategy | BoldStrategy |
---|---|---|
40% | ~2% | 6.4% |
50% | ~12.5% | 12.5% |
60% | ~34.4% | 21.6% |