Time is continuous time. I have a 3D state space, and transition rates across all of these.
Using the transition rates, I can compute a generator matrix
A associated with the markov process. My
A satisfies all requirements on a generator matrix:
A_ii < 0and
A_ij >=0for all i and j
- Also, rows sum up to zero.
I want to compute the implied stationary distribution
g given by
dot(A.T, g) = z sum(g) = 1
z is a zero vector. To ensure the second condition, I set
z_i = 1 for some
A_ii = 1,
A_ij = 0 for all
j != i.
Now, my problem is that I don't always get to invert
A, despite it satisfying all the conditions for a generator matrix. Python just gives me
scipy.sparse.linalg.dsolve.linsolve.MatrixRankWarning: Matrix is exactly singular
I have a suspect: My grid size. Let's call one of the three dimensions of the state space
u. For a fixed
u.max(), if I increase the grid size enough, I can usually invert
A. For the order of magnitudes: If the transition rate across grid points is around 100, inverting
A fails. When it's only around
10, it works.
Now, I can't always throw more grid points at the problem. Also, I'm not sure of the fundamental problem behind why the grid size matters where. Could anyone shed some light on what's happening here, and whether there's an alternative way forward?