I have a full set of sequences (432 observations to be precise) of 4 states $A-D$: eg
$$Y=\left(\begin{array}{c c c c c c c}
A& C& D&D & B & A &C\\
B& A& A&C & A&- &-\\
\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots\\
B& C& A&D & A & B & A\\
\end{array}\right)$$
EDIT: The observation sequences are of unequal lengths! Does this change anything?
Is there a way of calculating the transition matrix $$P_{ij}(Y_{t}=j|Y_{t-1}=i)$$ in Matlab or R or similar? I think the HMM package might help. Any thoughts?
Best Answer
Please, check the comments above. Here is a quick implementation in R.
Results:
A (probably dumb) implementation in MATLAB (which I have never used, so I don't know if this is going to work. I've just googled "declare vector matrix MATLAB" to get the syntax):