Simulating a Continuous time markov chain

조회 수: 42 (최근 30일)
Nazer Hdaifeh
Nazer Hdaifeh 2020년 8월 27일
댓글: Basma Bargal 2021년 9월 11일
I have a transition matrix Q of 5 states (5x5), reoccurrence is allowed. the final state is state five (Death) and initial state is State one (no disease) and the other states are the levels of the disease(lets say breast cancer). I want to simulate the markov chain using matlb ... any one can help me with that please?

채택된 답변

Dana
Dana 2020년 8월 27일
See here:
Also, if you have the econometrics toolbox, you can use simulate.
  댓글 수: 20
susman
susman 2021년 2월 2일
Thank you Dana. I have to work with non-homogeneous continuous time markov chains. But as a first looking a homogeneous version gives a very clear picture through your code. Please let me know if you know any good reference for non-homogeneous CTMC especially the coding part.
Secondly, regarding your code, I have following Q matrix with one absorpbing state as death and I set the parameters as T = 65 and nsims = 1000. But my simulations remain a straight line and there are no transitions. All simullations remain in state zero from the very begining. However, if I remove the absorbing state, it works well. Can you explain the reason for that?
Q = [-2.79760000000000 0.628400000000000 0 0 2.16920000000000;
0 -4.40770000000000 0.829800000000000 1.44820000000000 2.12970000000000;
0 0.672400000000000 -2.56400000000000 0 1.89160000000000;
0 0.413900000000000 0 -2.53480000000000 2.12090000000000;
0 0 0 0 0]
Basma Bargal
Basma Bargal 2021년 9월 11일
Hi Susman,
Wondering whether you found any code or references on how to go about non-homogenous MArkov Chains in Matlab?
Thanks

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

추가 답변 (1개)

Dana
Dana 2021년 2월 3일
편집: Dana 2021년 2월 3일
I don't know offhand of any non-homogeneous CTMC references, sorry.
Regarding your case, this part of the help section regarding ths inputs of simCTMC.m is relevant:
% nsim: number of simulations to run (only used if instt is not passed in)
% instt: optional vector of initial states; if passed in, nsim = size of
% instt; otherwise, nsim draws are made from the stationary
% distribution of the Markov chain (if there are multiple stationary
% distributions, an error is returned).
So if you don't pass in a vector of initial states in the variable instt, the program randomly draws nsim initial states from the stationary distribution of the MC. But when you have an absorbing state, the stationary distribution of the MC has probability 1 associated with the absorbing state, and 0 for every other state. If you draw the initial state randomly from this stationary distribution, you're always going to start with the absorbing state, and then of course you'll stay in that state forever, which obviously isn't very interesting.
Long story short, for cases like these you probably want to pick your own initial vector instt. How to pick it is up to you.
  댓글 수: 1
susman
susman 2021년 2월 3일
Great that makes sense. Thank you so much!

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

카테고리

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