An introduction to Markov Switching Model for Time Series
By: Rachita Pateria
Tags: Markov Chains, Markov Models, Time Series Analysis, Praxis, Data Science

Among all the Data Scientists that I know, only few have very little understanding of what time series actually is and the rest are absolutely scared of it ! Why, you ask ? Well, think of the first few deep sea divers back in 1850s who were sent on missions to explore the part of our planet no one had ever dreamed of exploring — and look at what they discovered ! Time Series is very much similar to that in the world of Data Science. It is one of the most diverse areas, that requires deep understanding of the basic time series models and a thirst to dive into the not-so-basic ones !

Today we are going to dive into one of the most interesting topics of time series — the Hidden Markov Model

So, let’s dive !

Which is the simplest approach for time series modelling ?

Generic Formula to calculate AR(p)

The simplest one is the linear autoregressive model approach, which assumes that the characteristics of the time series (mean and variance) stay the same during the whole time period under consideration but in reality, that is usually not the case. A time series can change behaviour completely from one period to the next due to some structural changes, eg., a stock price series can change its behaviour drastically from steadily trending to extremely volatile after a policy change or a macroeconomic shock.

How do we overcome this gap ?

The Markov Switching Model of Hamilton (1989), also known as the Regime Switching Model, is one of the most popular nonlinear time series models in the literature. This model involves multiple structures that can characterize the time series behaviours in different regimes or states or episodes. By permitting switching between these structures, this model is able to capture more complex and dynamic patterns.

Markov Property

A novel feature of the Markov switching model is its Markovian property, which states that the probability of transitioning to any particular state is dependent solely on the current state, and not on the sequence of state that preceded it.

Putting this in a mathematical probabilistic formula :

Hidden Markov Model probabilistic formula

As such, a structure may prevail for a random period of time, and it will be replaced by another structure when a switching takes place.

The Markov switching model also differs from the models of structural changes. While the former allows for frequent changes at random time points, the latter admits only occasional and exogenous changes. This model is therefore suitable for describing correlated data that exhibit distinct dynamic patterns during different time periods.

The original Markov switching model focuses on the mean behaviour of variables. This model and its variants have been widely applied to analyze economic and financial time series. Let us see how.

Think of the onset of an economic recessions when output and employment fall and stay low, and over time, both increase. Stock markets are known to not be steady and it may happen that these financial markets change their behaviour abruptly. Statistically, means, variances, and other parameters are changing across episodes (regimes) and very dramatically too. These situations usually occur due to changes in macroeconomic variables, policies or regulations. Our problem is to estimate when regimes change (or in other words, determine how long a regime exists) and what are the values of the parameters associated with each regime.

In Markov-transition models, in addition to estimating the means, variances, etc. of each regime, we estimate the probability of regime change as well. The estimated transition probabilities for some problem might be, the following:

from/to | |

state | 1 | 2

______________________________

1 | 0.80 | 0.20

2 | 0.75 | 0.25

Start in state 1. The probability of transiting from state 1 to state 1 is 0.80. Said differently, once in state 1, the process tends to stay there. With probability 0.20, however, the process transits to state 2. State 2 is not as persistent. With probability 0.75, the processes revert from state 2 to state 1 in the next time period.

Markov-switching models are not limited to two regimes, although two-regime models are common.

In the example above, we described the switching as being abrupt; the probability instantly changed. Such Markov models are called dynamic models. Markov models can also accommodate smoother changes by modeling the transition probabilities as an autoregressive process. Thus switching can be either smooth or abrupt.

Applications of Markov Chain Model

Although applications of Markov modelling include modelling languages, natural language processing (NLP), image processing, bioinformatics, speech recognition and modelling computer hardware and software systems, in this post we will throw light on its financial time series applications.

Economics and finance — Markov chains are used in finance and economics to model a variety of different phenomena, including asset prices and market crashes. The first financial model to use a Markov chain was from Prasad et al. in 1974. Another was the regime-switching model of James D Hamilton (1989), in which a Markov chain is used to model switches between periods high and low GDP growth (or alternatively, economic expansions and recessions). Dynamic macroeconomics heavily uses Markov chains. An example is using Markov chains to exogenously model prices of equity (stock) in a general equilibrium setting. Credit rating agencies produce annual tables of the transition probabilities for bonds of different credit ratings.

Further readings :

I recommend this video by Luis Serrano, who uses simple examples to explain the working of Markov Hidden Model.

Youtube : A friendly introduction to Bayes Theorem & Hidden Markov Models by Luis Serrano

That’s all from me ! Hope I have been of some use in helping you understand this concept and its applications. Hope this encourages you to deep dive further into time series.

Happy reading !

Citations :