Stan-code for Markov-switching vector autoregressive models

This post regards my MS_VAR Github repository, which contains code used in the following paper: Osmundsen, Kjartan Kloster, Tore Selland Kleppe, and Atle Oglend. “MCMC for Markov-switching models—Gibbs sampling vs. marginalized likelihood.” Communications in Statistics-Simulation and Computation (2019): 1-22. The model A Markov-switching vector autoregressive (MS-VAR) model is an autoregressive mixture model governed by a (hidden) finite state Markov chain. In the mentioned paper, the MS-VAR model is expressed as: