I am calculating transition probability matrix (TPM) using hmmestimate
command of MATALB.
The simple vector a=[ 1 1 1 1 3 3 3 2 1 3]
and for this the TPM is
hmmestimate(a,a)
ans =
0.6000 0 0.4000
1.0000 0 0
0 0.3333 0.6667
I believe it is calculated as : (1,3) element:
(# of 1->3 transitions)/(total # of 1) = 2/5 = 0.4
Same rule follows for all the elements. Then why not for element (3,2) and (3,3). For example: (3,2) element:
(# of 3->2 transitions)/(total # of 3) = 1/4 = 0.25
but the transition matrix calculated by MATLAB entry 0.33. For (3,3)
, according to my calculation the entry should have been (2/4)=0.5
but it is 0.6667
What am I missing?
Best Answer
You can't include the $3$ on the end in the count of $3$s because it has no successor. If you have $n$ values, there are only $n-1$ transitions.