필터 지우기
필터 지우기

Two state markov chain realization

조회 수: 6 (최근 30일)
lemontree45
lemontree45 2011년 7월 1일
I have a state transition probability matrix and a state probability vector
[0.9 0.1; 0.1 0.9] & [0.4 0.6] respectively.
Now, I want to generate the states according to this. say 100 state sequence.
Any sort of help would be appreciated.
Thanks.

채택된 답변

the cyclist
the cyclist 2011년 7월 2일
I have to admit that my memory of MC is a bit rusty. Does this do what you want? Do you expect a convergence to a state probability vector [0.5 0.5]?
If this is right, there are faster implementations, but I wanted to lay out the basics clearly.
transitionMatrix = [0.9 0.1; 0.1 0.9];
initialProbabilityState = [0.4; 0.6]; % Made it a column vector, rather than a row.
nStates = 100;
states = zeros(2,nStates);
states(:,1) = initialProbabilityState;
for ns = 2:nStates
states(:,ns) = transitionMatrix*states(:,ns-1);
end
  댓글 수: 1
the cyclist
the cyclist 2011년 7월 2일
Given that this is homework, it would be best if you were to post what you yourself have tried to do, and where you are stuck. Then, maybe you can get some hints from someone about how to proceed. You'll learn more that way than if someone just does your assignment for you.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 7월 2일
You've asked the same question multiple times. Sounds like you need to go back to your textbook to learn what is state transition probability and Markov chain.
  댓글 수: 5
lemontree45
lemontree45 2011년 7월 2일
Thank you. yes. Initial state can be obtained from the state probability vector. I have taken care of that part. Hope that side is correct. Also, I am getting >>sum(P,2)=[1 1]. so I guess that part is clear too.
I couldn't find any problem with my state transition probability matrix and the state probability vector. But still I am not able to regenerate the same sequence when I do the reverse step.
Is it really possible to regenerate it correctly or would there be some sort of uncertainty?
Fangjun Jiang
Fangjun Jiang 2011년 7월 2일
I don't think you can re-generate the exact sequence. Think about your probability matrix, it is derived from 100 state transition. There are so many other slightly varied sequence that can draw to the same probability matrix.
When you generate the state probability vector, remember that you vector should be defined as row vector as V=[0.9 0.1], and the next vector would be V*P. This is different from cyclist because the definition of P(1,1), P(1,2),P(2,1),P(2,2).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Markov Chain Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by