Regime Detection in Sub-Saharan Africa Equity Markets – A Hidden Markov Model Approach

Complaints of heightened risks in the sub-Saharan African equities markets are rife in the practitioner literature. Investors need an understanding of the volatility dynamics in these frontier markets. This paper uses the Hidden Markov Models to detect the points of regime changes in the volatility in the markets of Ghana, Kenya, Nigeria and Botswana. The daily closing indices of the exchanges and modeled 2and 3-regimes in the market were used. Information criteria selected the best fitting model of 2-regime changes corresponding to periods of low and high volatilities. This has been shown through smoothed volatility plots depicting times of regime changes over the sample periods. Investors will be guided in the strategies they choose by setting price filters according to the particular regimes. For regulators, the work will help in setting risk sensitive capital based on market regimes so that firms do not carry too much capital than is required.


INTRODUCTION
Global investment firms are turning to the frontier equity markets in the hope of making adequate returns for investors in the face of low interest rates and few opportunities to invest in developed markets. Berger et al. (2011) highlighted the low correlations between developed and frontier market returns as making the later good for portfolio diversification. Demirer (2013) identified the suitability of the equity markets of the Gulf States as being particularly ripe for inclusion in developed world portfolios. Sukumaran et al. (2015) in their discussion on the advantages provided by frontier markets for diversification, cited examples of low market correlations even at a time of the global financial crisis when there was significant uptick in correlations across most markets.
However, these investors are confronted with markets lacking adequate risk characterizations to properly direct capital. There are problems of dense markets with little information flow on assets (Harrison and Moore, 2012), inadequate corporate governance (Crittenden and Crittenden, 2014), poor reporting standards (Pineiro-Chousa et al., 2019) and absence of strong legal systems to enforce contracts (Salami, 2011;Buchanan et al., 2011). Investors are able to price these risks and adequately hedge them in the market. The problem of information flow shows up in thin and asymmetric trading as a result of market inefficiencies (Müller et al., 1997). The effects are discontinuities in trading in the form of sudden switching of the heteroscedastic nature of asset returns from a regime of low to a regime of high volatility and vice versa. This is an important point particularly for active investment. Getting these regimes right enables the implementation of key strategies that positions a trade or investment to minimize the downside risk of investment, while the upside is held to bring good returns. Indeed, most investment management firms that are able to implement the right strategies in equity markets bring rewards to the investors.
Changes in market regimes have been identified extensively in the emerging markets by various authors (Demirel and Unal, 2020). The switches or changes in regimes observed in the markets are a function of a number of factors. Assoe (1998) assigned experimentation of government macroeconomic and fiscal policies as the reasons for the switching of asset returns in equity markets. Basically, at the onset of new policies, investors assess their effects on asset prices or even the attractiveness of various asset classes and take steps to either invest in or dump their stocks. By so doing, asset prices change, sometimes dramatically and this registers in stock markets as regime changes in the returns. Ang and Timmermann (2012) studied the interest rates of developed markets of US and UK and discovered the regime switching in the markets are driven by macroeconomic changes, government pronouncement and regulations to do with the capital and financial market environments. Schaller and Norden (1997) added that conflicts also have the potential to trigger regime changes in asset returns in the financial markets.
Financial markets are characterised by multiple regimes resulting from feeds of the underlying economic, social and political developments. These activities are particularly in a flux in sub-Saharan African countries. What is important is for assets managers and investors to understand these dynamics and to be able to craft their trading strategies to fit the evolving market developments. Sub-Saharan African (SSA) markets have rather short histories to guide investors. Abrupt market changes are disruptive to even the smartest investment strategies. The resulting financial outcomes tend to be unexpected and typical of the dense equity markets of sub-Saharan Africa.
Indeed, market regimes change as a concept is now so pervasive in modeling financial asset returns and pricing in finance and economic disciplines. Regime switching can be seen as a universal stylized property of financial market returns apart from volatility clustering, heavy tails, asymmetry, amongst others recognized by Cont (2001). Wang and Theobald (2008) employed regime changes in some six emerging nations of Asia to study the volatility in those markets. Walid et al. (2011) used regime switching to study the nexus of stock market volatility and the performance of exchanges rates; Fiess and Shankar (2009) incorporated changes in regimes to look at the determinants of foreign exchanges rates; Aloui and Jammazi (2009) employed regime switching in the study of switching behaviour in crude oil markets, among others. Bahrini and Filfilan (2020) documented the impact of equity returns as a result of geopolitical disturbances in the Gulf Cooperation Council (GCC) region and the recent outbreak of the Covid-19 pandemic. As a concept, regime switching has also been used in developed markets (Marques et al., 2013;Kenourgios et al., 2011) and emerging markets (Assaf and Charif, 2017;Markoff, 1990) and frontier (Arjoon and Bhatnagar, 2017).
For the frontier equity markets of sub-Saharan Africa, there is a paucity of studies in the extant literature on the nature of market regimes. Bahloul and Abid (2014) mentioned regime changes within the broader Middle East and North Africa (MENA) regions but nothing specifically focused on SSA. King and Botha (2015) modeled the dynamics of volatility of selected African stocks. None of these papers, however, look at the specific points of regime switching in the data. This is the point of departure of this work. We track the specific points at which regimes change or switch in the returns data. Moreover, we have chosen some SSA frontier markets to reflect the geography of the west -Ghana, east -Kenya and southern regions -Botswana. Nigeria was selected in addition to Ghana in the western sub-Saharan region due to its size.
Frontier markets are coming of age and particularly for SSA equity assets, according to Asongu (2013) and Enisan and Olufisayo (2009), are increasingly becoming a feature of global investment portfolios. Given the problems of market information flow and thin trading on the continent with perhaps the exception of South African markets, this paper firstly alerts investors of the breakpoints in the data and secondly, guides in forming expectations about risks and returns in the various market regimes. We rely on both data-driven approach and the Hidden Markov Model (HMM) in achieving this insight into the risks posed by regime changes in the return series. It is important, in our view, that investors track the dates of volatility switches and use these signals to trade. In the words of Engle (2004): -The advantage of knowing about risks is that we can change our behavior to avoid them‖ (p. 1). This is a decisive contribution when we have demonstrated with smoothed probability plots of the returns of the indices of Ghana (GSE), Kenya (KSE hereafter to distinguish the abbreviation for that of Nigeria), Nigeria (NSE), and Botswana (BSE) exchanges. These plots show the points of low and high regimes across the sample.
The rest of the paper is outlined as follows. Section two reviews the mathematical basis of the Hidden Markov Model (HMM). We analysis the data in Section three followed by discussion of the model results in Section four. Section five concludes the paper.

Regime detection is a hidden
Markov problem with the model transitioning from one random state to another. These transitions are guided by a stochastic state space matrix with well-defined jumps which depend on the current state rather than the previous states. It is such a model that constitutes the HMM. The HMM has underlying latent states which are not directly observable but are known to influence their observations (Ephraim and Merhav, 2002). This adopted a notation similar to Murphy (2012) to establish the mathematical basis for the HMM. Let ,be a sequence of returns over time, * +. The joint probability density of the Markov chain can be written as: Equation (2) is simply a statement that the probability of seeing a sequence of observations, , , . . . , is a product of the initial observation and the conditional probability of observing successive observations. The conditional observation ( | ) is the stochastic transition matrix. Now, assuming there are states for our model with transitions from state to state in any given time , then the transition stochastic matrix is given as: Equation (3) possess the Markov property that each row of the matrix is such that ∑ .

Expectation maximum algorithm estimation
The HMM states are latent and by that, we used the Expectation Maximization algorithm (EM) of Meng and van Dyk (1997) in the estimation of these states. We let be the observed returns and the hidden latent variables. We seek to maximize the log-likelihood of the relation: Unfortunately, Equation (4) is hard to optimize due to the log function on the rightmost side. The EM algorithm instead of the Maximum Likelihood Estimations (MLE) indirectly gets round this difficulty by defining as the complete data log likelihood. We define the expectation of Equation (5) as: where ( ) denotes the auxiliary function of the expectation with respect to the previous parameter and the complete observed data, * +. In the last step, we maximize ( ) with respect to , thus:

RESULTS AND DISCUSSION
The data came from a sample of the daily closing indices from the equity markets of Botswana, Ghana, Kenya and Nigeria for the period January 04, 2011 to December 31, 2017. We calculated the log returns using ( ) . Table 1 provides the statistical summary of the returns for the sample period. We ran the HMM assuming two and three regime changes and compared the AIC, BIC and HQIC for regime fit. Table 2 shows the number of regimes and the corresponding fit criteria. Basically, Table 2 shows the returns in the markets admit two regime changes -low and high volatile market regimes. The AIC, BIC and HQIC of the two regimes have lower values than their corresponding values in the three regimes except for KSE where the BIC conflicts with the rest of the criteria. This could be the result of the seeming oscillation of the volatility even within a given regime.
The tables of estimates and the transitional matrices are shown in the appendix. The figures in the tables confirm two-regime stock markets with a low and high volatility characterizing them. The smoothed probability plots together with the time series of the various bourses are shown in Figures 1 to 4. The patterns in the regimes are obvious from the diagrams in Figures 1 to 4. The approximate dates are shown with the changes from low Bayesian information criterion (BIC); Akaike information criterion (AIC); Hannan-Quinn information criterion (HQIC). to high regimes and vice versa. For example, in Figure 1, we see the pattern of the low volatility regime being interrupted with high volatility regimes of rather short but frequent periods for the GSE. The market for most part has been quiet with the sudden switches in regimes clearly shown by tracing the periods down. In Figure 2, the NSE index for most periods is in the low regime. The period from 2011 to the latter part of 2014, there have been two, albeit brief spikes in volatility in the market. Thereafter, the market swung between the extremes of low and high volatility with no clear dominance of either of these regimes. The market has been interrupted increasingly by high volatility regimes from late 2014. The smoothed probability plot for KSE exhibits a flux in the volatility regimes. Even where it appears to be in either regime, the volatility oscillated somewhat. The rapid regime changes could be the result of interest rate on sensitive financial and banking services dominating the KSE. Elyasiani and Mansur (1998), Akella and Chen (1990) and Kurov (2010) identified the transmission of interest rate regimes to the bank and financial services firms which indeed triggers the heightened response of the stocks.
BSI shows the switch from low to high volatility regimes occurs with near regularity. In Figure 4, we see a market exhibiting an unstable regime, switching and each regime lasting for only short periods. BSI, even though, very small, has the most foreign firms with dual listing on the local and outside markets like London, Johannesburg, Toronto and Australia. The regularity of the market swings on the BSI could be a reflection of market volatility coming from outside Botswana. The volatility estimates and transition probabilities in each regime for the respective exchanges is summarized in the appendix Tables A1 to A4.
These regime changes and when they occur is relevant, first, to the pricing of financial assets and, secondly, to regulators in the setting of regulatory and risk capital.  Assets prices are based on their associated risks. In the low volatility regimes, risks of equities are stable. Asset prices therefore have to be priced with the particular regime in mind. Again, bearing in mind the changes in regimes, long-dated assets like equity derivatives should be staircased so that their prices vary according to market volatility regimes and subsequently change when prices recover or otherwise. For regulators, it is essential the economy uses capital properly. Risk allocation capital of firms should be tied to the regimes and therefore must be allowed to track the risks in the market and fall when volatility recedes. Lindquist (2004) proposed setting capital for especially banks to be sensitive to the risk in their assets. It will be prudent extending this proposal to cover all listed trading institutions to ensure they do not carry too much capital at any time than required.

Conclusion
Volatility is one of the measures used to measure the risk associated with equity trading in financial markets and understanding the dynamics of how this evolved is essential. Equity markets are made up of changing regimes stemming from the underlying shocks in the economy. These changes, according to Ang and Timmermann (2012), influence the level of volatility of the returns. For investment, trading and risk management purposes, detecting the change points in these regimes is essential to investment strategy. Traders able to detect the market regimes are better positioned to manage their strategies to prevent exposure to excess volatility. For the sub-Saharan African frontier markets, switching behaviour as a result of change in macroeconomic policy, regulations to do with financial and capital markets or indeed development in the socio-political landscape present a huge challenge for investment managers. This work helps in the identification of the regimes to help optimize trading in line with the regimes.