Steady State Probabilities (Markov Chain) Python Implementation
问题 Hi I am trying to generate steady state probabilities for a transition probability matrix. Here is the code I am using: import numpy as np one_step_transition = array([[0.125 , 0.42857143, 0.75 ], [0.75 , 0.14285714, 0.25 ], [0.125 , 0.42857143, 0. ]]) def steady_state_prop(p): dim = p.shape[0] q = (p-np.eye(dim)) ones = np.ones(dim) q = np.c_[q,ones] QTQ = np.dot(q, q.T) bQT = np.ones(dim) return np.linalg.solve(QTQ,bQT) steady_state_matrix = steady_state_prop(one_step_transition.transpose()