Regime-switching Model in Turing.jl

Is it possible to replicate this Stan model in Turing.jl?

https://khakieconomics.github.io/2018/02/24/Regime-switching-models.html

That article seems to be describing a relatively straightforward hidden Markov model.

In turing:
https://turing.ml/dev/tutorials/04-hidden-markov-model/

Changes in state are the regime changes described in that article. You can either sample the state path as in that tutorial, or use the Viterbi algorithm to calculate it for you. You can use the forward-backward algorithm to calculate the odds of being in a given regime at a given time.

For the emission distributions, one will be an autoregressive gaussian (conditioned on the prior value), whereas the other one is simply a gaussian.

1 Like