Hi, here’s an example of the sort that we can’t fit in Stan:
It’s a hidden Markov model where each data point comes from one of two states, so with N data points there are 2^N possibilities so you can’t just use the mixture model formulation as in the Stan manual (that is, unless I’m missing some simplification that would allow this, as I guess is possible).
As I describe at the link, I don’t actually like this model for this particular application (hot and cold spells in sports), but (a) there are real problems with unobserved latent states (for example, Phil Price’s models of indoor energy use), and (b) in any case, people want to fit these models all the time. The Jags code for this particular model is here: https://github.com/gjm112/HMMbaseball/blob/master/TwoStateModel_Pitchers_2016.R
So what’s to be done? Yes, I understand that discrete models are in general in some sense impossible to fit. Nonetheless, people are fitting them all the time.
So I don’t want the response on this thread to be “don’t do it” or “this problem is impossible to solve.” It may be impossible to get finite-time algorithms that are provably close or whatever, but it’s not impossible to get reasonable fits.
This particular example is not ideal–as I said, I don’t really like the model for this sports example–but I think it’s a good enough example for us to think seriously about how to attack these problems in Stan.