top of page

Market Regime Detection for Equity Forecasting

  • Writer: Derin Goktepe
    Derin Goktepe
  • 7 hours ago
  • 3 min read
Stock Market Analysis

Overview

Forecasting equity returns is notoriously difficult, especially because financial markets rarely behave in a stable or predictable way. In my newest published research, Market Regime Detection for Equity Forecasting, I explored whether identifying latent market regimes—such as low‑volatility bull markets or high‑volatility downturns—can improve short‑term return prediction.

As the paper notes, conventional models often “lack the capability to distinguish among distinct macroeconomic phases… developing directional biases that lead to large out‑of‑sample errors when market conditions change.” By contrast, regime‑aware models attempt to understand which environment the market is currently in before making a forecast.


This post summarizes the research and explains what I learned about using unsupervised clustering and Markov models to forecast 21‑day S&P 500 returns.


Why I Studied Market Regimes

Most forecasting models assume markets behave consistently over time. But real markets shift dramatically across macroeconomic environments—low inflation vs. high inflation, low rates vs. high rates, calm periods vs. tail‑risk events.

A model trained during one environment often fails in another. For example, a network trained during a low‑rate decade will struggle when inflation spikes or volatility surges.

This motivated me to study market regimes, which classify market behavior into distinct latent states. As the paper explains, “market behavior can be divided into specific latent states… and when adding a regime feature to a model, it can improve the model’s awareness of the given market conditions.”

My goal was to test whether regime detection could help deep learning models forecast short‑term returns more accurately.


Methodology

I used a 20‑year dataset (2006–2025) containing:

  • SPY daily returns

  • IWM daily returns

  • VIX

  • CPI YoY change

  • Federal Funds Rate


The target variable was the 21‑day forward cumulative return of the S&P 500.

To detect market regimes, I applied four unsupervised algorithms:

  • K‑Means

  • DBSCAN

  • Gaussian Mixture Models (GMMs)

  • Gaussian Hidden Markov Models (HMMs)


The optimal number of regimes was selected using the elbow method (for K‑Means) and BIC (for GMMs and HMMs). All regime labels were one‑hot encoded and added as features to LSTM networks.


To ensure fairness, I used Bayesian hyperparameter optimization with time‑series cross‑validation. All models were evaluated out‑of‑sample using r², MAE, and RMSE, and compared against two statistical baselines: predicting zero and predicting the historical mean.


Why These Findings Matter

The results demonstrate that context matters in financial forecasting. Markets behave differently across macroeconomic environments, and models that ignore this structure tend to overfit and fail out‑of‑sample.

Regime‑aware models:

  • reduce forecasting error

  • improve variance explanation

  • help models adapt to changing environments

  • offer a more realistic framework for short‑term prediction

While the improvements were modest, they were consistent—and meaningful enough to suggest that regime detection is a promising direction for future research.


What I Learned as a Researcher

Conducting this study taught me that:

  • Deep learning alone is not enough for financial forecasting.

  • Market regimes provide valuable context for understanding price behavior.

  • Hybrid models—combining clustering with LSTMs—can outperform pure neural networks.

  • Markov models remain powerful tools for structural market analysis.

I also learned that model performance is sensitive to the number of clusters chosen, and future work should incorporate statistical significance testing (such as Diebold‑Mariano) to validate improvements.


Full Research Paper

Readers who want to explore the complete analysis can access the published paper here:


bottom of page