1

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?

Brenlla
  • 131
  • 5
  • 1
    Your assumption is tantamount to supposing that matrix multiplication is just component-by-component multiplication, but that's not the case. – whuber Nov 22 '19 at 20:54

0 Answers0