0

I have the following snippet to calculate the steady state of a transition matrix:

import numpy as np
import scipy.linalg as la

if __name__ == "__main__":
    P = np.array([[0.5, 0.2 , 0.3, 0],
                  [0.5, 0 , 0.1 , 0.4],
                  [0.6, 0.1, 0, 0.3],
                  [0.5, 0.2, 0.3, 0]])
    # Sanity check:
    assert np.sum(P, axis=1).all() == 1.0
    print la.eig(P,left=True)[1]

and it prints:

[[ -8.78275813e-01  -7.07106781e-01  -5.00000000e-01   1.47441956e-01]
 [ -2.51874610e-01  -1.58270385e-16  -5.00000000e-01  -2.94883912e-01]
 [ -3.50434239e-01  -2.60486675e-16   5.00000000e-01  -5.89767825e-01]
 [ -2.05880116e-01   7.07106781e-01   5.00000000e-01   7.37209781e-01]]

If I understand correctly the first column of this is indeed the steady state. It does not make sense to me for the probability of being in a state to be negative. What have I missed?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Francisco Vargas
  • 653
  • 1
  • 7
  • 22
  • 1
    Regardless of whether your example is correct, I feel the need to note that **any nonzero scalar multiple of an eigenvector is an eigenvector**. This thus also includes vectors of the form _v = -n * w_, n in R \ {0} and _w_ an eigenvector. – Nelewout Dec 22 '15 at 21:30
  • haha you are correct I can just multiply by -1 and normalize them (not in the vector sense) since changing the orientation still satisfies the eigenvalues P -KI = 0 ! thanks so much that was a bit silly of me... nice linear algebra refresher... – Francisco Vargas Dec 22 '15 at 21:34
  • 2
    If N. Wouda's answer resolves your question then you should accept it by clicking the tick mark next to it rather than writing "[SOLVED]" in the question title. – ali_m Dec 22 '15 at 22:13

1 Answers1

6

Any nonzero scalar multiple of an eigenvector is an eigenvector. This thus also includes vectors of the form v = -n * w, n > 0 and w a positive eigenvector.

Nelewout
  • 6,281
  • 3
  • 29
  • 39