You can fit hidden Markov models in Stan (and thus, also in Stata! and Python! and R! and Julia! and Matlab!)

[cat picture]

You can fit finite mixture models in Stan; see section 12 of the Stan manual.

You can fit change point models in Stan; see section 14.2 of the Stan manual.

You can fit mark-recapture models in Stan; see section 14.2 of the Stan manual.

You can fit hidden Markov models in Stan; see section 9.6 of the Stan manual. You’ll probably want to start with the subsection on Semisupervised Estimation on page 172, take a look at that Stan program, and then read forward to see how to do prediction and read backward to see the program built up in stages.

Also this: “The program is available in the Stan example model repository; see http://mc-stan.org/documentation,” but I don’t know the name of the model so I don’t know how to find it in that big pile of programs.

You can fit all sorts of models in Stan; the above list just gives a sense of some of the latent discrete parameter models that can be fit in Stan. Sometimes people are under the impression that you can’t fit discrete-parameter models in Stan. Actually, you can, as long as you can sum over the possibilities in computing the target function. It’s no problem doing this in all the models listed above. And this summing makes the algorithms converge faster too.

P.S. Chapter and section references refer to the Stan 2.14.0 manual. Things will get moved around in later editions so when looking in the manual you should search for the topics, not go by section numbers.

P.P.S. See here for some background.

3 thoughts on “You can fit hidden Markov models in Stan (and thus, also in Stata! and Python! and R! and Julia! and Matlab!)

Leave a Reply

Your email address will not be published. Required fields are marked *