HMM Regime MVO
Mean-variance optimisation that conditions on a Markov-switching regime model. Returns are not stationary; this method explicitly accounts for shifting volatility and return regimes.
Overview
Indian and global equity markets exhibit clearly identifiable regimes — bull, bear, sideways — characterised by distinct mean returns and volatilities. Hamilton (1989) proposed modelling these unobserved states as a Markov chain. HMM Regime MVO fits a two-state Markov-switching regression on benchmark returns, computes the current regime probabilities, and uses them to mix regime-conditional estimates of and .
The result is a forward-looking MVO that responds to the prevailing regime, increasing risk-taking in benign environments and tightening in turbulent ones.
Algorithm
Step 1 — Fit Markov-switching model
On the benchmark return signal (or the cross-sectional mean if no benchmark is supplied), fit a two-state Markov regression with switching variance using statsmodels' MarkovRegression. This yields smoothed regime probabilities .
Step 2 — Regime-conditional moments
For each regime , compute the regime-weighted mean and covariance using the smoothed probabilities as weights:
Regimes with insufficient effective sample size fall back to global moments to avoid degenerate estimates.
Step 3 — Mix moments at the current regime
Using the current-period regime probability vector , mix the regime moments via the law of total expectation and variance:
Step 4 — Solve max-Sharpe MVO
Plug the mixed moments into the standard long-only max-Sharpe efficient frontier with weight bounds .
Advantages & Limitations
Advantages
- Regime-aware: Uses different moments in different regimes.
- Forward-looking: Conditions on the latest regime probabilities.
- Captures volatility clustering: Switching-variance accommodates calm vs turbulent regimes.
- Falls back gracefully: Sparse regimes use global moments instead of degenerating.
Limitations
- Convergence: EM can struggle on short or near-stationary series.
- Identification: Two states is a strong prior; reality may need more.
- Lagged response: Smoothed probabilities only fully reflect a regime change after the fact.
- Sensitive to signal: Different benchmarks or proxies produce different regimes.
References
- Hamilton, J. D. (1989). "A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle." Econometrica, 57(2), 357-384.
- Ang, A., & Bekaert, G. (2002). "International Asset Allocation with Regime Shifts." Review of Financial Studies, 15(4), 1137-1187.
- Guidolin, M., & Timmermann, A. (2007). "Asset allocation under multivariate regime switching." Journal of Economic Dynamics and Control, 31(11), 3503-3544.