In Qaru, there are two threads related to this problem:
The above is simple but very expensive. If we have a transition matrix of order n , then at each iteration we calculate the multiplication of the matrix matrix by the cost O(n ^ 3) .
Is there a more efficient way to do this? One thing that arises for me is to use Eigen decomposition. The Markov matrix is ββknown for:
- we are diagonalized in the complex domain:
A = E * D * E^{-1} ; - have a real eigenvalue 1 and other (complex) eigenvalues ββwith a length less than one.
The stationary distribution is an eigenvector associated with the eigenvalue 1, i.e. first eigenvector.
Ok, the theory is good, but I can't get it to work. Taking the matrix P in the first related question:
P <- structure(c(0, 0.1, 0, 0, 0, 0, 0, 0.1, 0.2, 0, 0, 0, 0, 0, 0.2, 0.3, 0, 0, 0.5, 0.4, 0.3, 0.5, 0.4, 0, 0, 0, 0, 0, 0.6, 0.4, 0.5, 0.4, 0.3, 0.2, 0, 0.6), .Dim = c(6L, 6L))
If I do this:
Re(eigen(P)$vectors[, 1])
What's happening? According to previous questions, stationary distribution:
# [1] 0.002590673 0.025906737 0.116580322 0.310880848 0.272020713 0.272020708