I am trying to build a HMM-based model using the forward algorithm and I am able to get the thing working reasonably well and pass SBC and whatnot. Now I would like to test it’s fit against real data and for that I would like to do posterior predictive checks.
This however seems non-trivial: in all resources here on HMMs people either use the Viterbi algorithm to compute the most likely sequence of states for each sample or use forward-backward algorithm to compute marginal posterior probabilities for each state at each time point. However, if I understand stuff correctly neither of this let’s me get a sample from the posterior predictive distribution of state trajectories and hence posterior predictive of the observed trajectories. (I might also be missing something basic, I just rediscovered HMMs few days ago and I am trying to stitch the info online with what I remember from lectures from years ago). Is there a reasonably easy way to do this in generated quantities? The only thing I can come up is to try to implement particle filtering in generated quantities and that seems quite complex.
The state space of my model is reasonably small-ish (3 - 7 states, ~20 time steps).
Or are people just happy with the most likely paths from Viterbi or forward-backward smoothed probabilities for their posterior predictive needs?
Thanks for any pointers!