I have been trying to find the stationary distribution pi
for a transition matrix P
My example 5x5 Matrix P results in an eigenvector I get by doing the following:
Example P matrix:
0.5 0.2 0.3
0.6 0.2 0.2
0.1 0.8 0.1
eigenvalue, eigenvector = eigen(P)
I get a 5x1 Vector for the eigen value with the last element being eigenvalue of 1. I believe that pi
should be some multiple of the eigenvector associated with that eigenvalue of 1. However, it seems like the eigenvectors I have are not a proportion of my pi
. What am I doing wrong?
EDIT: I have found that I should be doing eigen(P'). This at least gives me the correct eigenvectors, however how do I find the right multiple of the eigenvector to find pi
without knowing in advance what pi
is?
So far the post is correct. The way to find the proportion, or scale, is to use the fact that the sum of the stationary distribution pi
is always 1.
scale = 1/sum(eigenvector) # for the relevant eigenvector not the whole matrix
pi = eigenvector * scale