library(matlib)
## Warning: package 'matlib' was built under R version 4.3.3
Q <- 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), nrow = 7, byrow = TRUE)
R <- matrix(c(0.6, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0.4), nrow = 7, byrow = TRUE)
I <- diag(7)
new1 <- I - Q
N <- inv(new1)
B <- N %*% R
rownames(B) <- c("1", "2", "3", "4", "5", "6", "7")
colnames(B) <- c("0", "8")
B
## 0 8
## 1 0.9796987 0.02030135
## 2 0.9492466 0.05075337
## 3 0.9035686 0.09643140
## 4 0.8350515 0.16494845
## 5 0.7322760 0.26772403
## 6 0.5781126 0.42188739
## 7 0.3468676 0.65313244
B["1", "8"]
## [1] 0.02030135
bring his fortune up to 8 dollars (bold strategy).
Q <- matrix(c(0, 0.4, 0,
0, 0, 0.4,
0, 0, 0), nrow = 3, byrow = TRUE)
R <- matrix(c(0.6, 0,
0.6, 0,
0.6, 0.4), nrow = 3, byrow = TRUE)
I <- diag(3)
new1 <- I - Q
N <- inv(new1)
B <- N %*% R
rownames(B) <- c("1", "2", "4")
colnames(B) <- c("0", "8")
B
## 0 8
## 1 0.936 0.064
## 2 0.840 0.160
## 4 0.600 0.400
B["1", "8"]
## [1] 0.064
The second strategy gives him a better chance of getting out of jail. His probability is 0.064 when acting bold, where his probability is 0.02 when acting timid. Since 0.064 is larger than 0.02, it is a better probability.