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 bet 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
library(expm)
Loading required package: Matrix
Attaching package: ‘expm’
The following object is masked from ‘package:Matrix’:
expm
If he uses a timid strategy by only beggin 1 dollar each time.
p = rbind(.4, .6)
d0 = 1
# 0, 1, 2, 3, 4, 5, 6, 7, 8
r0 = cbind(1,0,0,0,0,0,0,0,0)
r1 = cbind(.6,0,.4,0,0,0,0,0,0)
r2 = cbind(0,.6,0,.4,0,0,0,0,0)
r3 = cbind(0,0,.6,0,.4,0,0,0,0)
r4 = cbind(0,0,0,.6,0,.4,0,0,0)
r5 = cbind(0,0,0,0,.6,0,.4,0,0)
r6 = cbind(0,0,0,0,0,.6,0,.4,0)
r7 = cbind(0,0,0,0,0,0,.6,0,.4)
r8 = cbind(0,0,0,0,0,0,0,0,1)
mtx = rbind(r0,r1,r2,r3,r4,r5,r6,r7,r8)
df <- data.frame(mtx)
df
x = cbind(0,1,0,0,0,0,0,0,0)
many = mtx%^% 100
final.states = data.frame(x %*% many)
colnames(final.states) <- c('$0','$1','$2','$3','$4','$5','$6','$7', '$8' )
round(final.states[9],2)
There is a 2% chance that the prisoner makes it out with the timid strategy.
# 0 , 1, 2, 4, 8
r0 = cbind(1,0,0,0,0)
r1 = cbind(.6,0,.4,0,0)
r2 = cbind(0,.6,0,.4,0)
r3 = cbind(0,0,.6,0,.4)
r4 = cbind(0,0,0,0,1)
mtx = rbind(r0,r1,r2,r3,r4)
df <-data.frame(mtx)
df
x = cbind(0,1,0,0,0)
many = mtx%^% 100
final.states = data.frame(x %*% many)
colnames(final.states) <- c('$0','$1','$2','$4', '$8' )
round(final.states[5],2)
With the bold strategy, there is a 12% chance of success. Despite the counterintuitive nature of these findings, the bold strategy is ‘safer.’