I am computing the infinitesimal generator of a continuous-time Markov chain from the transition probabilities p
. I am following the methodology described here, just translated the R code to python/numpy.
p = np.array([[0.8,0.2,0],[0.1,0.7,0.2],[0.1,0.1,0.8]]) # probabilities, rows sum to 1
values, vectors = np.linalg.eig(p)
q = vectors@np.diag(np.log(values))@np.linalg.inv(vectors)
print(q)
[[-0.238 0.273 -0.035]
[ 0.119 -0.392 0.273]
[ 0.119 0.119 -0.238]]
If q
contains transition rates, like explained in page 17 here, I would expect that given p[0,2]
is 0
, the corresponding q[0,2]
should also be 0, but that is not the case.
Is there something wrong with my methodology? or is it my assumption that 0 values in p
should also correspond to 0 values in q
?