# Calculating stationary distribution of Markov chain

56 vues (au cours des 30 derniers jours)
Sargondjani le 28 Juin 2012
Commenté : yizhou yang le 25 Nov 2019
I am calculating the stationary distribution of a Markov chain. The transition matrix P is sparse (at most 4 entries in every column)
The solution is the solution to the system: P*S=S
I use the following method:
St = eigs(P,1,1);
S = St/sum(St); %S is the (normalized) stationary distribution
but i was wondering if there is a faster method... I have no clue yet how fast it is going to be, but the faster the better, because the speed will determine how accurate i can make my grid (more accurate = larger transition matrix)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (2)

Oscar le 5 Nov 2013
The algorithm only worked for 2 dimensions. I have written an algorithm implementing the same method and it works for all dimensions. See attached file.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Oscar le 3 Nov 2013
Modifié(e) : Oscar le 3 Nov 2013
Section 6 and 7 of this document explain a method called 'state space reduction' for calculating the stationary distribution of a Markov Chain: http://www.math.wustl.edu/~feres/Math450Lect04.pdf
I have removed a typo from the program that is given in the document and now it is working. See attached file.
##### 2 commentairesAfficher AucuneMasquer Aucune
Clarisha Nijman le 2 Nov 2018
Dear all,
today I am working on a project and need a stable code for the stationary distribution. I tried several suggestions. This last one gives an error, but as I do not understand the details of the code, your advice is really needed. Can somebody give me some advice please?,
PP =
0.3333 0.1667 0.6000
0.3333 0.5000 0.2000
0.3333 0.3333 0.2000
>> p=limitdist(PP) In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in limitdist (line 27) p(j)=sum(p(1:j1).*(P(1:j1,j)));
yizhou yang le 25 Nov 2019
p(j)=sum(p(1:j1).*(P(1:j1,j))');
just need to transpose.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Stable Distribution dans Help Center et File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by