# What is this HMM called? Any code examples?

**URL:** <https://discourse.mc-stan.org/t/what-is-this-hmm-called-any-code-examples/26010>\
**Category:** CmdStan\
**Tags:** specification, techniques\
**Created:** [January 18, 2022, 9:22am UTC](https://discourse.mc-stan.org/t/what-is-this-hmm-called-any-code-examples/26010 "2022-01-18T09:22:45Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![caesoma](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/caesoma/32/19767_2.png) [@caesoma](https://discourse.mc-stan.org/u/caesoma)\
**Post date:** [January 18, 2022, 12:03pm UTC](https://discourse.mc-stan.org/t/what-is-this-hmm-called-any-code-examples/26010/3 "2022-01-18T12:03:09Z")

</div>

It looks to me that the only difference from the typical scheme is that the state is shown as separate nodes; you could instead show it as a single node with two components A = (a\_1, a\_2) and it would look like a regular Hidden Markov Model with one hidden node.

I’m not sure how common this is in HMMs, but in the general state-space formulation there would normally be vector-valued states, which could also take continuous values instead of discrete (I came across [a model that I thought of formulating as an HMM](https://discourse.mc-stan.org/t/how-to-specify-a-stochastic-state-space-model-with-discrete-hmm-like-output/22446) but couldn’t really figure out how and I ended up concluding that it was worth thinking of it as a general state-space model). The advantage of this is that it is general.

The advantage of the former is you can compute a closed-form likelihood and inference should be a lot easier. I’m guessing you can write down the (Markovian) update step and work out the recursion to get: P(X) = \sum\_A P(X|A) P(A), you will just have more state possibilities to sum over. I’d be curious to see if this works out if you carry it through.

---

_[View the full topic](https://discourse.mc-stan.org/t/what-is-this-hmm-called-any-code-examples/26010)._
