# Simulating a Continuous time markov chain

65 ビュー (過去 30 日間)
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 2020 年 8 月 27 日
See here:
Also, if you have the econometrics toolbox, you can use simulate.
##### 20 件のコメント表示非表示 19 件の古いコメント
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 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 2021 年 2 月 3 日
Great that makes sense. Thank you so much!

サインインしてコメントする。

### カテゴリ

Find more on Markov Chain Models in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by