2014-03-31 77 views
1

我有一個很大的右隨機矩陣(行數爲1).size〜20000x20000。我怎樣才能找到它的平穩分佈?隨機矩陣平穩分佈

我試圖計算特徵值和向量,並得到複雜的特徵值,eg.1 + 0i(多於一個)。

,並嘗試使用下面的方法:當我做反演solve()我得到了錯誤消息Error in solve.default(A):system is computationally singular: reciprocal condition number = 3.16663e-19

據我瞭解

pi=u[I-P+U]^-1

一會兒,門階 - 弗羅貝紐斯定理確保每個隨機矩陣作爲固有概率向量pi,即特徵值的最大絕對值總是1,所以pi = piP,並且我的矩陣具有所有正項,我可以得到一個uniq pi,我正確嗎? 或者如果有任何方法我可以計算行向量pi?

+0

我不認爲所有的正項保證矩陣是可逆的或具有一切積極,實特徵值。 (反例:兩列爲1的矩陣。) –

+0

看來我需要使用基本的限制therom.That真的是我希望使用的最後一種方法。 – user3482913

回答

1
  1. 每個隨機矩陣確實有一個平穩的分佈。由於P具有所有的行和= 1,所以 (P-1)具有行總和= 0 =>(P-1)*(1,...,1)總是給你零。所以排名(P-1)< = n-1,所以是轉置到P-1的排名。因此,存在q使得(t(P)-I)* q = 0 => t(P)q = q。

  2. 複雜的價值1 + 0i似乎對我來說是相當真實的。但是如果你只能得到複數值,即在i不是0之前的係數,那麼算法會在某個地方產生一個錯誤 - 它以數字方式解決問題,並且不一定總是成立。它產生多少個特徵值和矢量並不重要,重要的是它找到了特徵值1的正確特徵向量,這就是你所需要的。

  3. 確保您的固定分佈確實是您的極限分佈,否則在計算它時沒有意義。您可以嘗試通過將不同的向量與矩陣^ 1000相乘來找到它,但我不知道在您的情況下需要多少時間。

  4. 最後但並非最不重要的,這裏有一個例子:


# first we need a function that calculates matrix^n 
mpot = function (A, p) { 
    # calculates A^p (matrix multiplied p times with itself) 
    # inputes: A - real-valued square matrix, p - natural number. 
    # output: A^p 

    B = A 
    if (p>1) 
    for (i in 2:p) 
     B = B%*%A 
    return (B) 
} 


# example matrix 
P = matrix(nrow = 3, ncol = 3, byrow = T, 
      data = c(
       0.1, 0.9, 0, 
       0.4, 0, 0.6, 
       0, 1, 0 
      ) 
) 


# this converges to stationary distribution independent of start distribution 
t(mpot(P,1000)) %*% c(1/3, 1/3, 1/3) 
t(mpot(P,1000)) %*% c(1, 0, 0) 

# is it stationary? 
xx = t(mpot(P,1000)) %*% c(1, 0, 0) 
t(P) %*% xx 

# find stationary distribution using eigenvalues 
eigen(t(P)) # here it is! 
eigen_vect = eigen(t(P))$vectors[,1] 
stat_dist = eigen_vect/sum(eigen_vect) # as there is subspace of them, 
             # but we need the one with sum = 1 
stat_dist