4

I'm quite new to HMMs and depmix, so apologize if this question is too obvious.

I have a dataset that represents students' sequences. Not sure if that is relevant for this problem, but I could provide a sample. So, I tried to model sequences using depmix and seems like everything works fine. However, it randomly selects one of the states as an initial state. That basically means that every student starts from the state 1 (for example). I tried to change initial state probabilities in two ways: - setting "instart" argument in depmix to (0.33, 0.33, 0.33), and - defining instart as transInit and setting "prior" to the transInit object.

The first option would correctly assign initial probabilities to each state, however transitions from one state to another (transition matrix) are all equal - 0.33.

Using the second approach I would do something like this:

instart=c(0.33, 0.33, 0.33)
inMod <- transInit(~1, ns=3, ps=instart, data=code.hmm, pstart=c(trstart[1:3])) # pstart is basically 0.3, 0.3, 0.4

and whatever I do here:

mod.make <- depmix(cluster~1, family=multinomial("identity"), data=code.hmm, nstates=3, ntrails=sum[,2], prior=inMod)

I'm getting an error:

Error in formula == ~1 : 
  comparison (1) is possible only for atomic and list types
Srecko
  • 199
  • 4
  • 14

0 Answers0