Trending Assets
Top investors this month
Trending Assets
Top investors this month
Decoding Market Regimes: Unsupervised Learning Meets Macroeconomic Data
Image upload
The financial markets have always been a playground for the curious mind. As someone who's always been fascinated by the interplay between numbers and narratives, I couldn't resist exploring how machine learning could help us better understand the complex relationship between macroeconomic factors and market performance. In this study, I applied an unsupervised learning algorithm, KMeans clustering, to the S&P 500 Index (SPY) returns and various macroeconomic indicators in an attempt to identify distinct market regimes.

I gathered 20 years (a little less after dropping some missing data points) of monthly data for the S&P 500 Index returns and seven macroeconomic indicators, including unemployment rate, inflation rate, GDP growth rate, 10-year Treasury rate, federal funds rate, population, and median family income growth. After resampling the data to a monthly frequency, I filled in the gaps using interpolation and normalized the data.

Next, I employed the KMeans clustering algorithm to group the data into three distinct clusters. Why three clusters? It's a starting point for exploration (bullish, bearish, and ranging markets), but feel free to experiment with different numbers of market regimes. To visualize the clusters, I created scatter plots, with each data point representing the relationship between SPY returns and a given macroeconomic indicator for a specific month.

My analysis revealed several interesting insights:

Image upload

  1. Unemployment Rate: The relationship between SPY returns and the unemployment rate showed a clear inverse relationship. High unemployment rates were associated with lower market returns, while low unemployment rates were generally associated with higher returns. It aligns with the idea that periods of economic growth and low unemployment coincide with strong market performance.

Image upload

  1. Inflation Rate: The relationship between SPY returns and inflation rate was less apparent, with no strong trends emerging from the clusters. This could be due to the intricate and nuanced relationship between inflation and equity returns, which can be influenced by various factors such as interest rates and monetary policy.

Image upload

  1. GDP Growth Rate: The clusters revealed a positive relationship between SPY returns and GDP growth rate, with higher GDP growth rates generally corresponding to higher market returns. This finding supports the idea that economic growth and market performance are closely intertwined.

Image upload

  1. 10-Year Treasury Rate: The relationship between SPY returns and the 10-year Treasury rate was inconclusive. While some clusters showed a positive relationship, others showed no discernable pattern. This may suggest that other factors, such as investor sentiment and monetary policy, play a more significant role in determining market returns.

Image upload

  1. Federal Funds Rate: The clusters revealed no clear relationship between SPY returns and the federal funds rate. This could be due to the indirect impact of the federal funds rate on equity markets through its influence on borrowing costs and economic activity.

Image upload

  1. Population: The relationship between SPY returns and population growth was also inconclusive, with no strong trends emerging from the clusters. This could be because population growth may not have a direct impact on equity returns in the short term.

Image upload

  1. Median Family Income Growth: A positive relationship was observed between SPY returns and median family income growth. This suggests that periods of strong income growth could potentially coincide with higher market returns, possibly due to increased consumer spending and economic growth.

To sum things up, my analysis using KMeans clustering and macroeconomic data provides valuable insights into the relationship between market returns and various macroeconomic indicators. While some indicators, such as unemployment rate and GDP growth rate, appear to have a strong relationship with market performance, others like inflation rate and federal funds rate do not show clear trends. Further research and refinements to my approach may help uncover additional insights and improve our understanding of market dynamics. With the right data and tools at our fingertips, the possibilities are limitless.

Related
Already have an account?