I have a univariate count time series `y_t`, for `t = 1, ..., T` (for example earthquake or disease counts per period), and I want to fit a 3-state hidden Markov model in which each state emits counts from a Poisson distribution with its own rate.

My model is:
`z_1 ~ Categorical(pi)` over the `K = 3` states,
`z_t | z_{t-1} = j ~ Categorical(A_{j, .}), for t = 2, ..., T,`
`y_t | z_t = k ~ Poisson(lambda_k), for t = 1, ..., T,`
`A_{j, .} ~ Dirichlet(1), for j = 1, ..., K` (each transition row),
`pi ~ Dirichlet(1),`
`lambda_k ~ Gamma(a0, b0), for k = 1, ..., K,`
with the identifying constraint `lambda_1 < lambda_2 < lambda_3` (states ordered by ascending rate; the rates are well separated by design).

Here:
`y_t` is the observed count at time t,
`z_t` is the latent state at time t,
`pi` is the initial-state distribution,
`A` is the K x K transition-probability matrix (`A_{j,.}` is the row out of state j),
`lambda_k` is the Poisson rate in state k,
`a0, b0` are the Gamma shape and rate hyperparameters for the emission rates,
`T` is the number of time points,
`K` is the number of hidden states.
