Grando 10 Homework

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 if

  1. he bets 1 dollar each time (timid strategy).

Answer:

Smith’s betting chances can be represented in a transition matrix:

(tm_a <- matrix(c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0, 0, 0.6, 
    0, 0.4, 0, 0, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 
    0, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 
    0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0, 0, 0, 1), ncol = 9, byrow = TRUE))
##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
##  [1,]  1.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
##  [2,]  0.6  0.0  0.4  0.0  0.0  0.0  0.0  0.0  0.0
##  [3,]  0.0  0.6  0.0  0.4  0.0  0.0  0.0  0.0  0.0
##  [4,]  0.0  0.0  0.6  0.0  0.4  0.0  0.0  0.0  0.0
##  [5,]  0.0  0.0  0.0  0.6  0.0  0.4  0.0  0.0  0.0
##  [6,]  0.0  0.0  0.0  0.0  0.6  0.0  0.4  0.0  0.0
##  [7,]  0.0  0.0  0.0  0.0  0.0  0.6  0.0  0.4  0.0
##  [8,]  0.0  0.0  0.0  0.0  0.0  0.0  0.6  0.0  0.4
##  [9,]  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  1.0

From this week’s reading, we found that the probability for each initial state can be found by computing B = NR…

So, R is:

(rm_a <- matrix(c(0.6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.4), nrow = 7, byrow = FALSE))
##      [,1] [,2]
## [1,]  0.6  0.0
## [2,]  0.0  0.0
## [3,]  0.0  0.0
## [4,]  0.0  0.0
## [5,]  0.0  0.0
## [6,]  0.0  0.0
## [7,]  0.0  0.4

and \(N = {\left( I - Q \right)}^{-1}\):

qm_a <- matrix(c(0, 0.4, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 
    0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0.6, 0, 
    0.4, 0, 0, 0, 0, 0, 0.6, 0), ncol = 7, byrow = TRUE)
(nm_a <- solve(diag(7) - qm_a))
##           [,1]     [,2]      [,3]      [,4]      [,5]      [,6]       [,7]
## [1,] 1.6328311 1.054718 0.6693101 0.4123711 0.2410785 0.1268834 0.05075337
## [2,] 1.5820777 2.636796 1.6732752 1.0309278 0.6026963 0.3172086 0.12688343
## [3,] 1.5059477 2.509913 3.1792228 1.9587629 1.1451229 0.6026963 0.24107851
## [4,] 1.3917526 2.319588 2.9381443 3.3505155 1.9587629 1.0309278 0.41237113
## [5,] 1.2204600 2.034100 2.5765266 2.9381443 3.1792228 1.6732752 0.66931007
## [6,] 0.9635210 1.605868 2.0340999 2.3195876 2.5099128 2.6367962 1.05471848
## [7,] 0.5781126 0.963521 1.2204600 1.3917526 1.5059477 1.5820777 1.63283109

So, NR, or B, is:

(bm_a <- round(nm_a %*% rm_a, 3))
##       [,1]  [,2]
## [1,] 0.980 0.020
## [2,] 0.949 0.051
## [3,] 0.904 0.096
## [4,] 0.835 0.165
## [5,] 0.732 0.268
## [6,] 0.578 0.422
## [7,] 0.347 0.653

So, starting with 1 dollar in this scenario, there is a 2.0% chance of winning 8 dollars before losing all his money.

  1. he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).

Answer:

Again, we can solve this with a transition matrix; however, it will look slightly different this time.

Transition matrix:

(tm_b <- matrix(c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0, 0.6, 
    0, 0, 0, 0.4, 0, 0, 0, 0, 0.6, 0, 0, 0, 0, 0, 0.4, 0, 0, 0.6, 0, 0, 0, 0, 0, 
    0, 0, 0.4, 0, 0, 0.6, 0, 0, 0, 0, 0, 0.4, 0, 0, 0, 0, 0.6, 0, 0, 0, 0.4, 0, 0, 
    0, 0, 0, 0, 0.6, 0, 0.4, 0, 0, 0, 0, 0, 0, 0, 0, 1), ncol = 9, byrow = TRUE))
##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
##  [1,]  1.0    0  0.0    0  0.0    0  0.0    0  0.0
##  [2,]  0.6    0  0.4    0  0.0    0  0.0    0  0.0
##  [3,]  0.6    0  0.0    0  0.4    0  0.0    0  0.0
##  [4,]  0.6    0  0.0    0  0.0    0  0.4    0  0.0
##  [5,]  0.6    0  0.0    0  0.0    0  0.0    0  0.4
##  [6,]  0.0    0  0.6    0  0.0    0  0.0    0  0.4
##  [7,]  0.0    0  0.0    0  0.6    0  0.0    0  0.4
##  [8,]  0.0    0  0.0    0  0.0    0  0.6    0  0.4
##  [9,]  0.0    0  0.0    0  0.0    0  0.0    0  1.0

R matrix:

(rm_b <- matrix(c(0.6, 0.6, 0.6, 0.6, 0, 0, 0, 0, 0, 0, 0.4, 0.4, 0.4, 0.4), nrow = 7, 
    byrow = FALSE))
##      [,1] [,2]
## [1,]  0.6  0.0
## [2,]  0.6  0.0
## [3,]  0.6  0.0
## [4,]  0.6  0.4
## [5,]  0.0  0.4
## [6,]  0.0  0.4
## [7,]  0.0  0.4

N Matrix:

qm_b <- matrix(c(0, 0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0.4, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0.6, 0, 0, 0, 0, 0, 0, 0, 0, 0.6, 0, 0, 0, 0, 0, 0, 
    0, 0, 0.6, 0), ncol = 7, byrow = TRUE)
(nm_b <- solve(diag(7) - qm_b))
##      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,]    1  0.4    0 0.16    0  0.0    0
## [2,]    0  1.0    0 0.40    0  0.0    0
## [3,]    0  0.0    1 0.24    0  0.4    0
## [4,]    0  0.0    0 1.00    0  0.0    0
## [5,]    0  0.6    0 0.24    1  0.0    0
## [6,]    0  0.0    0 0.60    0  1.0    0
## [7,]    0  0.0    0 0.36    0  0.6    1

B Matrix:

(bm_b <- round(nm_b %*% rm_b, 3))
##       [,1]  [,2]
## [1,] 0.936 0.064
## [2,] 0.840 0.160
## [3,] 0.744 0.256
## [4,] 0.600 0.400
## [5,] 0.504 0.496
## [6,] 0.360 0.640
## [7,] 0.216 0.784

So, starting with 1 dollar in this scenario, there is a 6.4% chance of winning 8 dollars before losing all his money.

  1. Which strategy gives Smith the better chance of getting out of jail?

Answer:

The bolder strategy (b) gives the better chance of getting out of jail for te starting state of $1. Also, below is a graphical representation of the probability of getting out of jail for each state.

library(ggplot2)
ggplot(data = rbind(data = data.frame(type_val = "Conservative", start_val = seq(1, 
    7), val = bm_a[, 2]), data.frame(type_val = "Bold", start_val = seq(1, 7), val = bm_b[, 
    2])), aes(x = start_val, y = val, color = type_val)) + geom_line() + scale_x_continuous(breaks = c(1, 
    2, 3, 4, 5, 6, 7)) + scale_y_continuous(breaks = c(seq(0.1, 0.8, by = 0.1))) + 
    labs(x = "Starting Amount", y = "Proability of Getting Out of Jail", color = "Strategy") + 
    ggtitle("Jail Question Plot") + theme(plot.title = element_text(hjust = 0.5)) + 
    theme(plot.background = element_rect(fill = "lightgrey"), panel.background = element_rect(fill = "white"), 
        panel.grid.major.x = element_line(color = "lightgrey"), panel.grid.major.y = element_line(color = "lightgrey")) + 
    theme(axis.text = element_text(size = 12, color = "grey55"), axis.title = element_text(size = 14, 
        color = "grey55"), title = element_text(size = 14, color = "grey55"))

Here we see that the bold strategy give a better probability of getting out of jail regardless of the starting amount.