Skip to content
LeetQuant
QR05 Time Series and Econometrics

QR05 · Time Series and Econometrics · Lesson 5 of 5

Regime Changes

Structural breaks and the Chow test, unknown break dates, Markov-switching models with filtered versus smoothed probabilities, the bias–variance trade-off of rolling windows, and how to handle regime shifts in research.

17 min

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 τ\tau: a new mean, a new beta, a new variance. The Chow test asks whether a regression with kk coefficients has the same coefficients before and after a known date. Fit the pooled model (residual sum of squares RSSp\text{RSS}_p) and the two sub-samples separately (RSS1\text{RSS}_1, RSS2\text{RSS}_2):

F=(RSSp−RSS1−RSS2)/k(RSS1+RSS2)/(n−2k)∼Fk, n−2k under no break.F = \frac{\big(\text{RSS}_p - \text{RSS}_1 - \text{RSS}_2\big)/k}{\big(\text{RSS}_1 + \text{RSS}_2\big)/(n - 2k)} \sim F_{k,\,n-2k} \text{ under no break.}

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 FF (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 n=200n = 200, two coefficients and dates searched over the middle 70% of the sample, the 95th percentile of the maximum FF 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, k=2k = 2) over n=200n = 200 days. The pooled regression has RSSp=520\text{RSS}_p = 520. Splitting at an earnings announcement chosen in advance, the two halves have RSS1=230\text{RSS}_1 = 230 and RSS2=250\text{RSS}_2 = 250. Is there a break at 5%? What if the date had been found by scanning every day for the largest F?

Show solution

RSS1+RSS2=480\text{RSS}_1 + \text{RSS}_2 = 480, so the fit gain is 4040.

F=40/2480/196=202.449≈8.17.F = \frac{40/2}{480/196} = \frac{20}{2.449} \approx 8.17 .

The 5% critical value of F2,196F_{2,196} is about 3.043.04 (the p-value is about 0.00040.0004), 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 66 for this setup. 8.178.17 still passes, but a statistic of 44 or 55 that looks convincing against 3.043.04 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 St∈{1,2}S_t \in \{1, 2\} that follows a Markov chain with transition probabilities pij=P(St=j∣St−1=i)p_{ij} = P(S_t = j \mid S_{t-1} = i), and the return distribution depends on the state, e.g. rt∣St=j∼N(μj,σj2)r_t \mid S_t = j \sim N(\mu_j, \sigma_j^2).

Key quantities:

  • Expected duration of regime ii: 1/(1−pii)1/(1 - p_{ii}) (a geometric number of days).
  • Stationary probability of regime 1: π1=1−p222−p11−p22\pi_1 = \dfrac{1 - p_{22}}{2 - p_{11} - p_{22}}.
  • Unconditional moments are mixtures: with zero means, Var⁡(r)=∑jπjσj2\operatorname{Var}(r) = \sum_j \pi_j\sigma_j^2 and kurtosis 3∑jπjσj4/(∑jπjσj2)2>33\sum_j\pi_j\sigma_j^4 / (\sum_j\pi_j\sigma_j^2)^2 > 3. 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:

  1. Predict: push yesterday's state probabilities through the transition matrix.
  2. 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 P(St∣r1,…,rt)P(S_t \mid r_1, \dots, r_t) uses data up to tt. The smoothed probability P(St∣r1,…,rT)P(S_t \mid r_1, \dots, r_T) 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 N(0,0.82)N(0, 0.8^2) in the calm regime and N(0,2.52)N(0, 2.5^2) in the stress regime, with pcalm,calm=0.98p_{\text{calm,calm}} = 0.98 and pstress,stress=0.90p_{\text{stress,stress}} = 0.90.

(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 −2.5%-2.5\%. What is today's filtered probability of stress?

Show solution

(a) Durations: 1/0.02=501/0.02 = 50 days calm and 1/0.10=101/0.10 = 10 days stressed. Stationary: πcalm=0.10/(0.02+0.10)=0.833\pi_{\text{calm}} = 0.10/(0.02 + 0.10) = 0.833, πstress=0.167\pi_{\text{stress}} = 0.167. Variance: 0.833×0.64+0.167×6.25=0.533+1.042=1.5750.833 \times 0.64 + 0.167 \times 6.25 = 0.533 + 1.042 = 1.575, so the volatility is 1.255%1.255\% daily. Kurtosis: 3(0.833×0.84+0.167×2.54)/1.5752≈8.33(0.833 \times 0.8^4 + 0.167 \times 2.5^4)/1.575^2 \approx 8.3.

(b) Predict: P(stress today)=0.2×0.90+0.8×0.02=0.196P(\text{stress today}) = 0.2 \times 0.90 + 0.8 \times 0.02 = 0.196.

Update: the likelihood ratio of a −2.5%-2.5\% return, stress versus calm, is

φ(2.5/2.5)/2.5φ(2.5/0.8)/0.8=0.32 e(3.1252−1)/2≈25.6.\frac{\varphi(2.5/2.5)/2.5}{\varphi(2.5/0.8)/0.8} = 0.32\,e^{(3.125^2 - 1)/2} \approx 25.6 .

Posterior odds =(0.196/0.804)×25.6≈6.24= (0.196/0.804) \times 25.6 \approx 6.24, so P(stress)=6.24/7.24≈0.862P(\text{stress}) = 6.24/7.24 \approx 0.862.

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 ww is a bias–variance trade-off:

  • Noise. Estimator variance scales like 1/w1/w. For a volatility estimate from ww normal returns, the relative standard error is about 1/2w1/\sqrt{2w}: 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 ww days. An exponentially weighted estimate with half-life HH has moved a fraction 1−2−t/H1 - 2^{-t/H} of the way after tt days: 50% at t=Ht = H, 75% at t=2Ht = 2H.

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 k=2k = 2 coefficients on n=100n = 100 observations has pooled RSSp=300\text{RSS}_p = 300, and the two sub-samples around a pre-chosen date have RSS1+RSS2=270\text{RSS}_1 + \text{RSS}_2 = 270. 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: F=[(RSSp−RSS1−RSS2)/k]/[(RSS1+RSS2)/(n−2k)]F = [(\text{RSS}_p - \text{RSS}_1 - \text{RSS}_2)/k]/[(\text{RSS}_1 + \text{RSS}_2)/(n - 2k)] for a date fixed in advance; a searched-for date needs sup-F critical values, roughly double here.
  • Markov switching: durations 1/(1−pii)1/(1 - p_{ii}), 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 (∝1/w\propto 1/w) against lag (ww 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).