SV · Regimes
Hidden Markov model regimes
Also called: HMM, HMM regimes, Markov-switching model
A hidden Markov model treats market regimes as unobserved states that switch over time, each with its own return and volatility behavior.
Definition
A hidden Markov model (HMM) assumes the market is always in one of a small number of unobserved states, such as calm and turbulent, that switch according to fixed transition probabilities. Observed returns are drawn from a distribution that depends on the current state.
Fitting the model gives each state's characteristics and, at every date, the probability that the market is in each state.
Intuition
Returns often look as if they come from different worlds at different times: low volatility with drift in some periods, high volatility with sharp moves in others. An HMM formalizes that idea and lets the data decide where the boundaries are, instead of using a fixed volatility threshold.
Because the state is inferred probabilistically, the model also says how confident it is, which is useful for scaling exposure rather than switching on and off.
How it's calculated
For K states with transition matrix A (Aij = P(st = j | st−1 = i)) and Gaussian emissions:
rt | st = j ~ N(μj, σj²)
Parameters are estimated by the Baum–Welch algorithm, a form of expectation–maximization. Then:
- The forward algorithm gives filtered probabilities
P(st = j | r1, …, rt), using data only up to t. - The forward–backward algorithm gives smoothed probabilities that also use later data.
- The Viterbi algorithm gives the single most likely state path.
The expected duration of state j is 1 / (1 − Ajj) periods.
Example: if the calm state's probability of staying calm each day is 0.98, its expected duration is 1 / (1 − 0.98) = 50 trading days; a turbulent state with a 0.90 stay probability lasts about 10 days on average.
How to read it
Label states by their fitted parameters, for example the state with the highest σ as "high volatility". Watch the filtered probability: a move from 0.9 to 0.6 in the calm state is an early sign that conditions are changing, even before the most likely state flips.
Refit periodically and check whether states keep similar parameters; if they swap or merge, labels can silently change meaning.
Common mistakes
- Using smoothed probabilities or Viterbi paths in a historical test; they use future data and create look-ahead bias.
- Choosing too many states, which overfits and gives unstable labels.
- Assuming state labels are stable across refits.
- Ignoring fat tails within a state; Student-t emissions are often more realistic.
In Saqrid
SV's volatility-regime screener ranks assets by their current hidden Markov model state.
A bias chip on every SV chart shows the asset's volatility regime, with an optional ±σ volatility envelope.
Open SV.
