Hierarchical Hidden Markov Model with Categorical and Continous Dependent Variables

Does anyone have a recomendation or example of hierarchical hidden markov model with a combination of continuous and categorical outcomes? I am trying to estimate a HHMM with mixture of behavioral (choice) and affective (positive, negative, neutral) data (100 individuals, 120 trials). I have found examples with either type, but not mixture of both data types.

1 Like

Can you give a more complete explanation of the model? I’ve implemented a couple of HMMs, but I’m not an expert, so I would have thought it’s something else if you have a continuous outcome, and maybe you need two separate models for it.

It’s not clear to me if this refers to the behavioral and affective outcomes (with seem to me like they are both categorical), or if you are referring to the categorical and continuous outcomes you mention in abstract in the question.

If it’s just two different categorical outcomes it should be relatively straightforward (although it may become very flexible and difficult to identify all parameters), if it’s the latter you may need something else entirely.

HMMex.csv (3.3 KB)

@caesoma Thank you for the reply. I uploaded an example single subject that is representative of the type of data we have. The model would identify latent states where emotion and behavioral choice were congruent and states where they were incongruent. We anticipate a third 'indecision state" where affect is primarily neutral. Variables are:

  • ID (just a single subject)
  • Trial (1-120)
  • Stimulus (two types or stimuli in task)
  • Response (-1, 0, 1) for “Dislike”, “I don’t know”, and “Like”
  • Positive_affect (scale 0-1) derived from physiological markers
  • Negative_affect (scale 0-1) derived from physiological markers
  • Neutral (scale 0-1) derived from physiological markers

The affective states are a probability of given state collected over the time period of each trial. The data suggest that multiple affective states can be heightened on a given trial. The data can be split into specific emotions as well, but this is the simpler model.

The model we would like to estimate tests whether different groups have different transition probabilities between these states and where stimulus type interacts with group to affect transition probabilities.

I see what you mean with the continuous and discrete outcomes. I thought Positive/Negative/Neutral were outcomes for the same variable, but they are each measured on a continuous scale. I don’t think you can formulate a HMM with those outcomes, since it requires summing over all possible sequences, and on a continuous scale that is impossible. If you need to combine two different models, one could be an HMM, I assume, the other a more general state-space model – or maybe in practice that just makes it a general state-space model with both kinds of outomes.
Maybe others with more experience on HMMs will have other suggestions: @martinmodrak, @vianeylb


It is relatively straightforward to write down a HMM where the likelihood consists of emission probabilities for multiple outcomes conditional on the latent state, assuming that those outcomes are conditionally independent. The full emission probability would just be the product of the emission probabilities for the various outcomes (probability densities for the continuous outcomes). But as @caesoma says, the latent state itself cannot be continuous. What I cannot quite tell from your question is whether you intend to discretize the underlying latent state. If so, then all you need to complete the HMM is to write down a joint likelihood for the emission probabilities, which reduces to a simple product in the case of conditional independence. But if not, then this does not seem to be a Hidden Markov Model at all.