Read Me First — Regime Lab
The Regime Lab uses a Hidden Markov Model (HMM) to infer latent market states from observed behavior such as returns, momentum, and realized volatility. A regime is an estimated statistical state—not a certainty and not a label the market reveals directly.
What this lab is designed to do
The Regime Lab uses a Hidden Markov Model (HMM) to infer latent market states from observed behavior such as returns, momentum, and realized volatility. A regime is an estimated statistical state—not a certainty and not a label the market reveals directly.
Key controls and inputs
- Observed features. The current implementation uses measures such as weekly return, four-week momentum, and four-week realized volatility.
- Training window. The amount of history used to fit the HMM can materially affect state estimates and transition probabilities.
- Number / interpretation of states. State numbers are arbitrary. Interpret them from their return, volatility, and persistence characteristics rather than assuming “State 1” always means bull.
- Transition probabilities. These estimate how likely the model believes a state is to persist or change.
- Fixed strategy baseline. The same option rule without regime information is the control that the HMM-guided approach must beat.
- Walk-forward test. This is the important test because each decision should use only information that would have been available at that time.
What the outputs mean
- Regime history. Shows how the fitted model partitions the sample into latent states.
- State characteristics. Average return, volatility, and persistence help translate anonymous state numbers into economically meaningful descriptions.
- Current probabilities. These are probabilities, not certainties. A 70% state probability still leaves substantial uncertainty.
- Oracle comparison. An oracle-style experiment can estimate the maximum theoretical benefit of knowing the true simulated state. It is not a tradable result.
- Walk-forward HMM strategy result. This is the practical research test: how much of the theoretical regime advantage survives real-time estimation?
A good first experiment
- Fit the model using the default feature set and training window.
- Inspect each state’s return, momentum, volatility, and persistence before naming it.
- Run the fixed-strategy baseline first.
- Run the oracle regime-aware experiment to estimate whether regime knowledge could matter at all under the simulated environment.
- Run the walk-forward HMM-guided strategy and compare it with the fixed baseline—not with the oracle.
- Change the training window and repeat. If state definitions or results change drastically, the regime signal may be unstable.
How to interpret the result
Do not judge the strategy from one path, one seed, or one favorable market environment. Read return, drawdown, exposure, trade frequency, and benchmark-relative performance together. A result is more credible when it persists across reasonable parameter changes and when the comparison benchmark has similar economic exposure.
Important assumptions and limitations
- HMMs assume the data can be represented by a finite number of latent states with probabilistic transitions. Real markets may not obey that structure.
- State labels can switch between fits; always interpret states by their estimated statistics.
- A good in-sample segmentation can still fail out of sample.
- Feature selection, training window, and number of states create model risk and opportunities for overfitting.
- Regime persistence can disappear abruptly during crises or policy changes.
How this complements backtesting
A conventional backtest can test a regime rule over historical data, but the HMM must be fit walk-forward to avoid look-ahead bias. Simulation adds an important second layer: because the true simulated state can be known, the lab can compare the estimated HMM signal with an oracle and measure how much information is lost in real-time inference.