Solved – Markov Chain State Transition Probability in R

markov chainprobabilitytime series

I have a dataset which shows the states (3 states) across 11 time points for each participant. I wanted to estimate the Markov Chain state transition probability matrices for time points 2-11 using R. I read both markovchain and HiddenMarkov package documentations, but did not see any examples similar to what I planned to do. The most relevant example is the one listed under MarkovchainFit (in markovchian package), but it seems to me the data entry is a sequence of states (not a sequence of states for an each individual participant), and there is only one transition matrix calculated. I appreciate any suggestions. That is also great if any other statistical software can support the calculation. Thank you!

Best Answer

The current version of markovchain package has implemented a function to address your issue.

library(markovchain)
data(holson)
mcListFist<-markovchainListFit(data=holson[,2:12],name="holson")
Related Question