Is expm accurate to compute transition probabilities for a continuous-time Markov chain?

2 views (last 30 days)
Yufei Cao
Yufei Cao on 7 Jul 2021
Answered: Yazan on 7 Jul 2021
I have the following Q-matrix for a continuous time Markov chain and use expm to compute transition probabilities.
syms t positive
Q = [-2 1 1;
1 -1 0;
2 1 -3];
P(t) = expm(Q*t);
double(P(2))
Matlab gives
ans =
0.3797 0.4908 0.1295
0.3704 0.5092 0.1205
0.3794 0.4908 0.1298
My question is that I think ans(2,3) should be zero, becasue Q(2,3)=0. But Matlab shows that ans(2,3)=0.1205.
Thanks in advantage.

Answers (1)

Yazan
Yazan on 7 Jul 2021
expm(sig) computes the matrix exponential of sig according to:
[V,D] = eig(sig)
expm(sig) = V*diag(exp(diag(D)))/V
For your example:
Q = [-2 1 1;
1 -1 0;
2 1 -3];
P = expm(Q*2);
[V,D] = eig(Q*2);
P2 = V*diag(exp(diag(D)))/V;
% maximum difference
max(P2(:) - P(:))

Community Treasure Hunt

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

Start Hunting!