Chapter 11 Page 423

8 In Example 11.13 (Drunkard’s Walk) of this section, assume that the proba- bility of a step to the right is 2/3, and a step to the left is 1/3. Find N, Nc, and NR. Compare these with the results of Example 11.15.

Answer:

library(matlib)

Find N

Q <- matrix(c(0, 1/3, 0, 2/3, 0, 1/3, 0, 2/3, 0),nrow = 3)
Q
##           [,1]      [,2]      [,3]
## [1,] 0.0000000 0.6666667 0.0000000
## [2,] 0.3333333 0.0000000 0.6666667
## [3,] 0.0000000 0.3333333 0.0000000

Make an Identity matrix

I  <- diag(1,3,3)
I
##      [,1] [,2] [,3]
## [1,]    1    0    0
## [2,]    0    1    0
## [3,]    0    0    1
IQ <- I - Q
IQ
##            [,1]       [,2]       [,3]
## [1,]  1.0000000 -0.6666667  0.0000000
## [2,] -0.3333333  1.0000000 -0.6666667
## [3,]  0.0000000 -0.3333333  1.0000000

Take inverse if IQ

N <- inv(IQ)
N
##      [,1] [,2] [,3]
## [1,]  1.4  1.2  0.8
## [2,]  0.6  1.8  1.2
## [3,]  0.2  0.6  1.4

Find Nc:

c <- matrix(1,nrow = 3)
NC <- N%*% c
NC
##      [,1]
## [1,]  3.4
## [2,]  3.6
## [3,]  2.2

Find NR:

R <- matrix(c(1/3,0,0,
              0,0,2/3), nrow = 3)
R
##           [,1]      [,2]
## [1,] 0.3333333 0.0000000
## [2,] 0.0000000 0.0000000
## [3,] 0.0000000 0.6666667
NR <- N %*% R
NR <- round(NR,3)
NR
##       [,1]  [,2]
## [1,] 0.467 0.533
## [2,] 0.200 0.800
## [3,] 0.067 0.933