HMM with time-varying probabilities

One more thing:
To the best of my knowledge, Stan’s built-in hmm_marginal function only works with time-invariant transition probabilities. Your title suggests that you are working with time-varying transition probabilities, though I don’t quite grasp how time-varying transition probabilities enter into your description of the problem.

When you say

I’m led to believe that you are working with hmm_marginal and not your own implementation of the forward algorithm. If that’s true, and if it’s true that you intend to work with time-varying transition probabilities, then I think something unintentional must be happening such that you are not passing the time-varying transition probabilities that you want. It is not too difficult to write reasonably efficient implementations of the forward algorithm in Stan code without using hmm_marginal, and to set these up to accept time-varying transition matrices. Some resources linked here:

1 Like