It's a confusion between the left and right eigenvectors. Try eigen(t(stoma))
.
I found it useful to try out the example from the wikipedia article on stochastic matrices:
p <- matrix(c(0,0,1/4,0,0,0,0,1/4,0,0,
1/2,1,0,1/2,0,0,0,1/4,0,0,1/2,0,1/4,1/2,1),
ncol=5)
p
[,1] [,2] [,3] [,4] [,5]
## [1,] 0.00 0.00 0.5 0.00 0.50
## [2,] 0.00 0.00 1.0 0.00 0.00
## [3,] 0.25 0.25 0.0 0.25 0.25
## [4,] 0.00 0.00 0.5 0.00 0.50
## [5,] 0.00 0.00 0.0 0.00 1.00
Check it's a stochastic matrix:
rowSums(p)
## [1] 1 1 1 1 1
Eigenvalues:
zapsmall(eigen(p)$values)
## [1] 1.0000000 0.7071068 -0.7071068 0.0000000 0.0000000
Eigenvectors:
print(zapsmall(eigen(p)$vectors),digits=3)
## [,1] [,2] [,3] [,4] [,5]
## [1,] 0.447 0.354 0.354 -0.802 -0.609
## [2,] 0.447 0.707 0.707 0.535 -0.167
## [3,] 0.447 0.500 -0.500 0.000 0.000
## [4,] 0.447 0.354 0.354 0.267 0.776
## [5,] 0.447 0.000 0.000 0.000 0.000
(Results as yours but sign arbitrary flipped. R scales eigenvectors so that the sum of squares of each column is 1: sqrt(1/5)
is approx. 0.447 ...)
You're looking for the other (left?) eigenvectors:
print(zapsmall(eigen(t(p))$vectors),digits=3)
## [,1] [,2] [,3] [,4] [,5]
## [1,] 0 -0.149 0.3011 -0.5 0.707
## [2,] 0 -0.149 0.3011 0.5 0.000
## [3,] 0 -0.422 -0.8517 0.0 0.000
## [4,] 0 -0.149 0.3011 -0.5 -0.707
## [5,] 1 0.869 -0.0517 0.5 0.000