# Markov Switching Models for Recession Prediction

#### The Idea

Markov switching models or more generally regime switching models (MSM, RSM) can be seen as extensions to an arbitrary model that performs well in certain scenarios, but fails when applied to a larger data set due to its temporal non-stationarity. RSMs address this issue by assuming that there are multiple underlying states of the system that switch between them according to a certain stochastic process.

The Idea is similar to the state space models from 3.3, however here state (or regime) isn’t a continuous variable,  but has a finite number of values (e.g., “bull market” and “recession”). MSMs assume that evolution of the regime is a Markov process. That means for each pair of regimes there is a fixed probability of a transition from one state to another and in each point of time the model decides whether it will change the state randomly according to these probabilities and independent of the history.

The simplest example would be a CAPM model from 3.1 (for simplicity just AAPL vs. SPY) with two regimes and transition probabilities p12 (from recession to growth), p21 (from growth to recession) and probabilities to stay within each regime p11,p22. Of course we can work with more than two regimes and models beyond the linear regression (as far as we know how to fit them).

regime 1: Y AAPL = β Y SPY + α for t during recession t1t1
regime2:YAAPL=βYSPY +α for t during growth t2t2

#### The Implementation

Currently we are using tsa.regime switching module from statsmodel library allowing to infer the parameters for multiple regression and auto-regression models including the transition probabilities. Also the library hmmlearn is worth mentioning (was part of scikit-learn until deprecated in the 0.17 release). Stata is commercial statistical software with their implementation of Markov switching regression models. We mention it here because of their good documentation stata.com/manuals14/tsmswitch.pdf.

#### The Usage

As we mentioned, MSMs can act as an add-on for many models allowing them to differentiate between different model regimes. Therefore the application field of these models is quite broad. For us the most important of them is recession outlook and risk measurement (that can be again used for many downstream tasks), for others we leave references to the most recent work utilizing RSMs on the corresponding field.

For many financial data sets fitting a MSM with two regime results in two parameter sets (e.g,. two sets of auto-regression parameters) where one corresponds to a model describing market behavior during recession and growth period. As we know we learn the transition probabilities together with the model parameters, but it is also possible to compute the probabilities of being in a certain regime for each time step. This values (e.g., probability of being in the “recession” regime, see Figure 3.4) can be interpreted as a risk measure and used further for tasks like portfolio or trading optimization.

About the IMM International Market Merchants:
IMM International Market Merchants is a FinTech Software Development Vendor/ Automating Financial Services, Investment Management, Quantitative Trading
Web: www.immpartners.com

##### Disclosure: Interactive Brokers

Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from IMM International Market Merchants and is being posted with its permission. The views expressed in this material are solely those of the author and/or IMM International Market Merchants and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

##### Disclosure: Displaying Symbols on Video

Any stock, options or futures symbols displayed are for illustrative purposes only and are not intended to portray recommendations.