Estimating a dynamic switching process

This is a tough one.

One approach could be to model the number (and time) of shocks instead of the probability of shocks. Here are two related examples:

It’s still tricky to sample because the most likely parameters of the random walk (or Autoregressive process) are likely to be very different for different number of switches (so multimodal on the margins) and it might be difficult for the sampler to switch between those states.

I am very curious if there’s a more established way that others may know. Maybe @jessegrabowski, @RavinKumar?