1
$\begingroup$

State duration in HMMs follows a geometric distribution by construction. How can one estimate the state duration, since it is not explicitly modeled (e.g., in HSMMs)? I'm particularly interested in the following packages: hmmlearn (Python) and depmixS4 or hmm (R).

For example, a left-right HMM starts in state 1. Suppose the model has been learned. After getting some observations, suppose I obtain the following best state sequence by applying the Viterbi algorithm: 2-2-3-3-3-4. How do I estimate the time it took from state 1 to state 4? Do I have to sample from a geometric distribution (where its parameter p is the state transition probability) for each state transition (i.e., 1-2, 2-2, 2-2, 2-3, etc.), and then add up all sampled values until state 4 is reached? If that's correct, then I would carry out this procedure several times to get summary statistics (mean, standard deviation, etc.) of the total "time" from state 1 to 4. But sampling from the geometric distribution gives me an integer value. What does that mean? Am I missing some concepts?

$\endgroup$
  • 2
    $\begingroup$ If the state sequence (including the starting state $1$) is $1-2-2-3-3-3-4$, is the answer not $6$ steps? Is the issue here that you are looking to average over other possible sequences, not just the most likely one? Or are you looking for a continuous time model? (Or am I misunderstanding something) $\endgroup$ – Juho Kokkala Jan 15 '18 at 7:20
  • $\begingroup$ I see. I guess I was getting a bit confused between "time" and "transition". See my comment on @TitoOrt's answer. $\endgroup$ – Bruno Jan 15 '18 at 12:43
1
$\begingroup$

I will try to give you some ideas to see if this helps:

First of all, as long as you work with HMM (as you mention you do) avoid using "time" concept. Here, you are working with transitions. This might be time related if transitions happen always after some determined time. But I would not use "total time" and would use "total number of transitions" instead.

Having said that, of course the number of transitions the system will remain in a certain state a is geometrically distributed in the case of HMM. Imagine a state has a self transition probability of P(a->a) = 0.5. The probability of remaining in that step for two transitions or steps would be 0.5*0.5=0.25, three 0.125 and so on... This defines a geometric distribution with parameter p as you indicated.

Sampling from that geometrical distribution will therefore give you an integer corresponding to the number of steps the state remains unchanged (self transition). But again, careful with the time concept. As @Juho Kokkala suggested, that particular sequence of states took 6 steps or transitions.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ So I guess I shouldn't be thinking in terms of "time", but "transitions" or "steps", right? And even in HSMMs, the "duration time" is actually the number of transitions or steps. Does this mean that in a continuous time model, there's actually the notion of "time" to go from state i to state j? $\endgroup$ – Bruno Jan 15 '18 at 12:46
  • $\begingroup$ Yes and no. Yes, you should be thinking about transitions instead of time. No, HSMM actually uses the temporal function to let the system to stay in the same state for a period of time. Only when that time finishes is when a transition is triggered (usually self transition is not allowed in HSMM). You can have a look at this paper( ieeexplore.ieee.org/document/7792429) for more clarifications. $\endgroup$ – TitoOrt Jan 15 '18 at 12:56
  • $\begingroup$ Thanks for sharing it. But even in discrete-time HSMMs, the concept of "state duration" or "sojourn time" is still discrete, correct? That is, we're still dealing with time steps. $\endgroup$ – Bruno Jan 15 '18 at 15:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.