Objective
Every model so far assumed its parameters are fixed. Markets violate that: betas, correlations, volatility levels and signal strength all shift. This lesson covers the two main ways to model the shift (a one-off structural break, or recurring regimes in a Markov-switching model), how to test for it, how rolling estimation trades noise against lag, and the research mistakes regimes invite.
Structural breaks and the Chow test
A structural break is a change in model parameters at some date : a new mean, a new beta, a new variance. The Chow test asks whether a regression with coefficients has the same coefficients before and after a known date. Fit the pooled model (residual sum of squares ) and the two sub-samples separately (, ):
The numerator measures how much fit is gained by letting the coefficients differ; the denominator is the noise level. The test assumes the error variance is the same in both halves, which is often false in markets; a heteroscedasticity-robust Wald version is safer.
Unknown break date. If you search over candidate dates and report the largest (the sup-F or Quandt–Andrews test), the ordinary F critical value is badly wrong, because you took the maximum of many correlated statistics. In a simulation with , two coefficients and dates searched over the middle 70% of the sample, the 95th percentile of the maximum under no break was about 6.0, against about 3.04 for a single pre-chosen date. Other tools: CUSUM tests on recursive residuals for gradual instability, and Bai–Perron for several breaks.
Worked example
did the beta change?
A stock's daily returns are regressed on the market (intercept and beta, ) over days. The pooled regression has . Splitting at an earnings announcement chosen in advance, the two halves have and . Is there a break at 5%? What if the date had been found by scanning every day for the largest F?
Show solutionHide solution
, so the fit gain is .
The 5% critical value of is about (the p-value is about ), so with a pre-specified date the break is strongly significant.
If the date was chosen by scanning, compare instead with the sup-F critical value of about for this setup. still passes, but a statistic of or that looks convincing against would not. Saying this distinction unprompted is what interviewers listen for.
Markov-switching models
A break happens once. Regimes recur: calm and stressed markets alternate. A Markov-switching model has a hidden state that follows a Markov chain with transition probabilities , and the return distribution depends on the state, e.g. .
Key quantities:
- Expected duration of regime : (a geometric number of days).
- Stationary probability of regime 1: .
- Unconditional moments are mixtures: with zero means, and kurtosis . Persistent regimes also produce volatility clustering, so the model competes with GARCH as an explanation of the stylised facts.
Filtering. The state is never observed; you infer it. The Hamilton filter alternates two steps each day:
- Predict: push yesterday's state probabilities through the transition matrix.
- Update: multiply by the likelihood of today's return in each state and renormalise (Bayes' rule).
The parameters are estimated by maximum likelihood (or EM) over the whole sample.
Filtered vs smoothed. The filtered probability uses data up to . The smoothed probability uses the whole sample, including the future. Smoothed probabilities draw beautiful, sharp regime charts, and using them in a backtest is look-ahead bias. Even filtered probabilities use full-sample parameters unless the model is re-estimated on an expanding window.
Worked example
a calm–stress model
Daily returns (in %) are in the calm regime and in the stress regime, with and .
(a) Find the expected durations, the stationary probabilities, the unconditional volatility and the kurtosis. (b) Yesterday the filtered probability of stress was 0.2. Today's return is . What is today's filtered probability of stress?
Show solutionHide solution
(a) Durations: days calm and days stressed. Stationary: , . Variance: , so the volatility is daily. Kurtosis: .
(b) Predict: .
Update: the likelihood ratio of a return, stress versus calm, is
Posterior odds , so .
One three-sigma (by calm standards) day moves the filter from 20% to 86%. The code below runs the same filter for a few more days of quiet returns; the probability decays back as the calm likelihood wins.
from statistics import NormalDist
P = [[0.98, 0.02], # calm -> calm, calm -> stress
[0.10, 0.90]] # stress -> calm, stress -> stress
dists = [NormalDist(0, 0.8), NormalDist(0, 2.5)] # daily returns in %
def hamilton_filter(returns, p_stress=0.2):
probs = [1 - p_stress, p_stress]
out = []
for r in returns:
# predict: push yesterday's probabilities through the transition matrix
pred = [sum(probs[i] * P[i][j] for i in range(2)) for j in range(2)]
# update: Bayes' rule with today's return
joint = [pred[j] * dists[j].pdf(r) for j in range(2)]
probs = [v / sum(joint) for v in joint]
out.append(round(probs[1], 3))
return out
print(hamilton_filter([-2.5, 0.3, -0.5, 0.4, 0.2]))
Output:
[0.862, 0.545, 0.276, 0.113, 0.043]
Rolling estimation: noise versus lag
The model-free response to instability is to estimate on recent data only. The window length is a bias–variance trade-off:
- Noise. Estimator variance scales like . For a volatility estimate from normal returns, the relative standard error is about : about 9.1% with 60 days, 4.5% with 250 days. Means are far worse: a mean return is essentially unestimable from a few months of data.
- Lag. After a break, a rolling window's estimate moves linearly from the old to the new value and reaches it only after days. An exponentially weighted estimate with half-life has moved a fraction of the way after days: 50% at , 75% at .
Choose the window from the quantity's own persistence: volatility changes fast and is cheap to estimate (short windows work), betas and correlations change slowly and are noisier (longer windows), expected returns hardly at all from data alone. An expanding window is efficient if nothing changes and maximally laggy if something does. A Kalman filter on time-varying coefficients makes the trade-off explicit through the ratio of state noise to observation noise.
Handling regime shifts in research
- Report by regime, decide in advance. Show performance in high and low volatility, rising and falling markets, defined by rules fixed before the backtest. Conditioning variables chosen after seeing the results are overfitting.
- Use real-time information only. Filtered, not smoothed, probabilities; parameters re-estimated on expanding or rolling windows; break dates you could have known at the time.
- Test stability, not just significance. Rolling or split-sample estimates of the key coefficient, Chow or sup-F tests at economically motivated dates, and CUSUM plots.
- Prefer robustness to prediction. Volatility scaling, diversification across signals and conservative leverage limit the damage of a regime you did not predict; switching strategies on and off based on a fitted regime model adds parameters and turnover.
- Remember the model-risk link. A structural break can masquerade as high persistence (GARCH), a unit root (ADF), or a broken cointegration relation. When a parameter estimate drifts towards a boundary, suspect a break.
Knowledge check
A regression with coefficients on observations has pooled , and the two sub-samples around a pre-chosen date have . What is the Chow F statistic?
Knowledge check
In a two-state Markov-switching model, the stress regime stays stressed with probability 0.95 each day. What is the expected length of a stress episode?
Knowledge check
A researcher fits a Markov-switching model to 20 years of data and backtests a rule that cuts exposure whenever the smoothed probability of the stress regime exceeds 50%. The backtest looks excellent. What is the main problem?
Knowledge check
A volatility estimate uses a 60-day rolling window of normal returns. Roughly what is its relative standard error, and what is the cost of lengthening the window to 250 days?
Key takeaways
- Chow: for a date fixed in advance; a searched-for date needs sup-F critical values, roughly double here.
- Markov switching: durations , stationary probabilities from the transition matrix, mixtures that produce fat tails and clustering, and a Bayes filter for the hidden state.
- Smoothed regime probabilities use the future; only filtered probabilities with real-time parameters belong in a backtest.
- Window length trades noise () against lag ( days to catch up); pick it by how fast and how noisily the parameter moves.
- Breaks can look like high persistence, unit roots or failed cointegration; when estimates drift to a boundary, test for a break.
Practice problems
Finished reading?
Answer the 4 knowledge checks to complete this lesson (0 done).