- Published on
Structural Breaks
Structural Breaks
This chapter discusses methods for detecting structural breaks, which are transitions from one market regime to another (e.g., from mean-reversion to momentum). These breaks are valuable for ML strategies because they catch most market participants off guard, leading to irrational behavior (like holding losing positions) that creates profitable, high-risk/reward opportunities.
The chapter divides these detection methods into two main categories: CUSUM tests and Explosiveness tests.
CUSUM Tests
These tests detect a structural break by measuring if a cumulative sum of errors or deviations significantly departs from zero.
Brown-Durbin-Evans CUSUM Test: This test uses recursive least squares (RLS) to get 1-step ahead recursive residuals (). A structural break is suspected if the cumulative sum of these standardized residuals () crosses a predefined threshold.
- CUSUM Statistic:
- CUSUM Statistic:
Chu-Stinchcombe-White CUSUM Test: A simpler test that works directly on log-price levels () by assuming the null hypothesis is "no change." It measures the departure of the current price from a past reference price .
- Statistic:
- Critical Value: The test statistic is compared against a time-dependent critical value.
- To solve for the arbitrary start point , the test is often run as .
- Statistic:
Explosiveness Tests (Bubble Detection)
These tests are designed to detect bubbles (exponential growth or collapse), which standard unit-root tests often miss. Standard tests are poor at distinguishing a stationary process from a periodically collapsing bubble.
Chow-Type / Supremum Dickey-Fuller (SDFC):
- Concept: Assumes the process switches once from a random walk () to an explosive process () at an unknown break date .
- Method: It fits an ADF-style regression with a dummy variable for the break.
- Statistic: Since the break date is unknown, it takes the supremum (maximum) of the test statistic over all possible break dates.
- Flaw: It cannot detect multiple bubbles (e.g., a bubble-burst-bubble cycle).
Supremum Augmented Dickey-Fuller (SADF):
- Concept: This is the robust method for detecting multiple, periodically collapsing bubbles.
- Method: Instead of one break date, it fits the ADF regression on a backwards-expanding window. For each end point , it recursively tests all possible start points . A spike in the SADF statistic indicates a bubble.
- Statistic:
- Key Refinements:
- Use Log Prices: Always use log prices, not raw prices, as they provide a more stable model of bubble dynamics.
- Robustness: SADF is sensitive to outliers since it uses the
sup(maximum). More robust alternatives include QADF (Quantile ADF, which takes the -th percentile) and CADF (Conditional ADF, which takes the conditional mean of values above a quantile).
RiskLabAI Implementation
In our RiskLabAI library, we provide a robust implementation for the (G)SADF tests in the features.structural_breaks.structural_breaks module. The implementation is modular, breaking the complex problem into a series of clear steps.
- Lagging: The
lag_dataframefunction creates a DataFrame with the necessary lagged features. - Matrix Preparation:
prepare_dataconstructs the properly aligned dependent variable () and independent variable matrix () for the ADF regression, handling the specifiedconstanttype ('c', 'ct', etc.) andlags. - OLS Computation:
compute_betaefficiently computes the OLS coefficients () and variance-covariance matrix () for a given window of and . - Test Statistics: We provide two main functions:
get_expanding_window_adf: Computes the standard ADF t-statistic over an expanding window, which is useful for plotting the test statistic's evolution.get_bsadf_statistic: Computes the Backward Supremum ADF (BSADF) statistic by finding the supremum t-statistic across all possible expanding windows. This is the core test for detecting bubble origination.
- Sub- and Super-Martingale Tests (SMT):
- Concept: An alternative to ADF that does not assume an autoregressive process.
- Method: Tests for explosive trends (e.g., polynomial, exponential, or power) on expanding windows, similar to SADF.
- Statistic: Includes a penalty term to adjust for sample length.
Implementation: Drift-Burst Hypothesis (DBH)
To test the effectiveness of explosiveness and bubble detection algorithms (like SADF), we need synthetic data that exhibits these characteristics. In our RiskLabAI.data.synthetic_data.drift_burst_hypothesis module, we implement the Drift-Burst Hypothesis (DBH) model.
This model generates drift and volatility parameters for a bubble scenario, featuring a predictable "explosion" at the midpoint (t=0.5) of the series.
Methodology
The model defines drift and volatility as a function of time t (from 0 to 1), where the denominator approaches zero at the midpoint, causing a burst:
To prevent division by zero, the model uses a small explosion_filter_width to clamp the denominator near the explosion point.
API reference
RiskLabAI implements these in Python and Julia (signatures auto-generated from the package source):
| Python | Julia |
|---|---|
| |
| |
| |
| |
| |