This code contains the code for the benchmark model in the paper "An Anatomy of Merger Waves" (joint with Carlo Chiarella) published in the Journal of Financial Econometrics, Volume 17, Issue 2, Spring 2019, Pages 153–179. The code contains the main script to estimate a Markov regime switching Poisson regression model with an efficient MCMC algorithm. The data refer to a single industry M&A deals. The code contains a set of auxiliary functions. The main script is GibbsSamplerWeb.m.