Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- P = (1/40)*matrix(c( 0, 20, 5, 5, 5, 5,
- 8, 0, 8, 8, 8, 8,
- 10, 0, 0, 10, 10, 10,
- 10, 0, 10, 0, 10, 10,
- 10, 0, 10, 10, 0, 10,
- 10, 0, 10, 10, 10, 0), nrow=6, byrow=T)
- P
- ## [,1] [,2] [,3] [,4] [,5] [,6]
- ## [1,] 0.00 0.5 0.125 0.125 0.125 0.125
- ## [2,] 0.20 0.0 0.200 0.200 0.200 0.200
- ## [3,] 0.25 0.0 0.000 0.250 0.250 0.250
- ## [4,] 0.25 0.0 0.250 0.000 0.250 0.250
- ## [5,] 0.25 0.0 0.250 0.250 0.000 0.250
- ## [6,] 0.25 0.0 0.250 0.250 0.250 0.000
- g = eigen(t(P))$vectors[,1] # t=transpose for row (not column) eigenvector
- lim.dist = g/sum(g) # to make vector sum to 1
- lim.dist = as.numeric(lim.dist) # kill complex number notation
- g
- ## [1] -0.4719292+0i -0.2359646+0i -0.4247363+0i -0.4247363+0i
- ## [5] -0.4247363+0i -0.4247363+0i
- lim.dist
- ## 0.19607843 0.09803922 0.17647059 0.17647059 0.17647059 0.17647059
- lim.dist %*% P # '%*%' denotes matrix multiplication in R
- ## [,1] [,2] [,3] [,4] [,5] [,6]
- ## 0.1960784 0.09803922 0.1764706 0.1764706 0.1764706 0.1764706
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement