Get 40% Off
🚨 Volatile Markets? Find Hidden Gems for Serious Outperformance
Find Stocks Now

Stock Market Regime Shifts In Real Time: A Test

Published 06/22/2014, 01:06 AM
Updated 07/09/2023, 06:31 AM

Earlier this month I wrote about an econometric tool—Hidden Markov model (HMM)—for identifying the start of bear markets, as early as possible and with a relatively high degree of confidence. The record looks encouraging for the past 50 years with the US stock market (S&P 500), although some readers wondered if this upbeat in-sample analysis would hold up in an out-of-sample context. That’s always a relevant question when forecasting (or nowcasting or even backcasting). Many models look wonderful with historical numbers only to stumble when applied in real time going forward. Is that fate for the HMM process I outlined a few weeks ago? Not necessarily, as a bit of testing suggests.

I’ve analyzed the HMM application for the S&P 500 by using only the data available up to various points in history. The results of this experiment suggest that HMM will hold up on an out-of-sample basis.

For instance, consider how the model would have worked at the start of the Great Recession, which began in January 2008, according to NBER. The stock market was beginning to crack around this time, although that’s only obvious in hindsight. In January 2008, in fact, there was still widespread optimism that the economy and the stock market, although both were wobbling at the time, would resume their upward trajectories. The crowd would eventually learn otherwise, but this would take months to sort out in terms of convincing the average investor. By contrast, the real-time signals of HMM in January and February of 2008 were reflecting a regime shift, i.e., the start of a bear market. (Something similar was unfolding for macro via the recession warning in the vintage data for the Economic Trend Index, but that’s another subject.)

3rd party Ad. Not an offer or recommendation by Investing.com. See disclosure here or remove ads .

At the start of February 2008, crunching the available stock market data up to that point with a HMM indicated a regime shift—the bull market regime had switched to a bear market regime. (Note: I’m using the depmixS4 package in R for the analysis.)

S&P 500 Regime State -  1-Yr % Changes

HMM-associated probabilities began dropping clues of an impending regime shift a few weeks earlier. Although the probability signals in January didn’t quite rise to the level of an outright regime shift, the consistently rising odds of a new bear market looked worrisome as the first month of 2008 unfolded. For instance, here’s how the HMM probability profile stacked up when running the available numbers through January 18, 2008:

S&P 500 Bear Market Probablility - 1-Yr % Change

Clearly, the risk of a new bear market was on the march, reaching 50% in mid-January 2008. By the end of that month, HMM analysis would all but confirm that the tipping point had been reached.

It all looks obvious now, but optimism was still the dominant view as that fateful year opened. For perspective, here’s how the S&P 500 looked during this period. Note that while the equity market in early 2008 was off its recent highs, casual observation still left plenty of room for thinking that all was well. HMM was telling us otherwise in the early weeks of 2008, offering an advance warning of the trouble to come.

S&P 500 Overview

The idea that HMM can work well on an out-of-sample basis isn’t unusual. Indeed, a recent study finds encouraging results on this front (“Regime Shifts: Implications for Dynamic Strategies,” by M. Kritzman, et al., Financial Analysts Journal, May/June 2012). No big surprise, then, that I’ve found similar results in my own research, such as the one test discussed above.

3rd party Ad. Not an offer or recommendation by Investing.com. See disclosure here or remove ads .

HMM isn’t perfect—nothing is when it comes to modeling stochastic systems such as the stock market and the economy. This is finance, not physics. But HMM is certainly worthy as one of several tools for monitoring macro and market risks.

By the way, I just ran the numbers with S&P data through Thursday, June 19, 2014, and HMM says that the bull market regime is still in force. Nothing lasts forever, of course, and so this analysis is subject to change, and perhaps sooner than the crowd assumes. When will the regime shift? No one knows for sure. But in the search for an early warning, I expect that HMM will drop an early clue.

Latest comments

Risk Disclosure: Trading in financial instruments and/or cryptocurrencies involves high risks including the risk of losing some, or all, of your investment amount, and may not be suitable for all investors. Prices of cryptocurrencies are extremely volatile and may be affected by external factors such as financial, regulatory or political events. Trading on margin increases the financial risks.
Before deciding to trade in financial instrument or cryptocurrencies you should be fully informed of the risks and costs associated with trading the financial markets, carefully consider your investment objectives, level of experience, and risk appetite, and seek professional advice where needed.
Fusion Media would like to remind you that the data contained in this website is not necessarily real-time nor accurate. The data and prices on the website are not necessarily provided by any market or exchange, but may be provided by market makers, and so prices may not be accurate and may differ from the actual price at any given market, meaning prices are indicative and not appropriate for trading purposes. Fusion Media and any provider of the data contained in this website will not accept liability for any loss or damage as a result of your trading, or your reliance on the information contained within this website.
It is prohibited to use, store, reproduce, display, modify, transmit or distribute the data contained in this website without the explicit prior written permission of Fusion Media and/or the data provider. All intellectual property rights are reserved by the providers and/or the exchange providing the data contained in this website.
Fusion Media may be compensated by the advertisers that appear on the website, based on your interaction with the advertisements or advertisers.
© 2007-2024 - Fusion Media Limited. All Rights Reserved.