Skip to content
Stan-code for Markov-switching vector autoregressive models
Stan R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


The repository contains code used in the following paper:

"MCMC for Markov-switching models — Gibbs sampling vs. marginalized likelihood",

by Kjartan Kloster Osmundsen, Tore Selland Kleppe & Atle Oglend.

The code fits a Markov-switching vector autoregressive model to data input. The user can specify the data, number of regimes and number of autoregressive terms. The regimes can be applied to the mean structure and/or the covariance structure.

See the wiki for detailed instructions. See also this blog post.

The code assumes that the R-packages rstan and coda are installed (and rstudioapi if you are using Rstudio).

You can’t perform that action at this time.