Confidence as a Leading Indicator: HMM Regime Detection During the COVID-19 Crash

The Signal That Came Too Early

On January 27, 2020, while Carnival Cruise Lines stock traded at 44.75 — still near its high — our 3-state Hidden Markov Model assigned it a 99.99% confidence to “CrisisRegime . QQQ, the Nasdaq-100 ETF, simultaneously received a 99.95% Bearish confidence rating at 210.72, well before any significant decline.

This wasn’t hindsight; this was real-time regime detection accomplished with no lookahead bias.

Three weeks later, on February 19, the market would peak. Five weeks later, on March 23, it would bottom — down 34% - in what would become the fastest crash in market history. But by then, our model had already seen it coming.

This case study examines how regime confidence levels can serve as leading indicators of market conditions, demonstrating that a simple 3-state HMM framework can detect structural shifts before they fully manifest in price action. The complete analysis code is available on GitHub.

CCL Snapshot at Market Peak
Figure 1: CCL at the market peak (Feb 19, 2020). Despite elevated prices, the model’s confidence metrics had already signaled danger weeks earlier.

Real-Time Adaptive Framework with No Lookahead Bias

Before diving into the results, it’s critical to understand the methodology that makes these findings credible: our analysis uses incremental training with guaranteed no lookahead bias.

Training Approach

The study employs a two-phase approach:

  1. Initial Training: Model is trained on 2018-2019 data (pre-COVID period)
  2. Incremental Updates: At each timestep during 2020, the model receives incremental training updates using only past data

This approach is enforced by the TemporalController class in the Hidden Regime framework, which guarantees that at any point $t$, the model has only seen data from $[t_0, t-1]$.

Here’s the study configuration:

 1# Date ranges
 2TRAINING_START = "2018-01-01"
 3TRAINING_END = "2019-12-31"
 4ANALYSIS_START = "2020-01-01"
 5ANALYSIS_END = "2020-12-31"
 6
 7# Tickers to compare
 8TICKERS = ["QQQ", "CCL", "WMT", "AMZN", "DIS", "INTC"]
 9
10# HMM configuration
11N_STATES = 3
12
13# Key COVID events for reference
14COVID_EVENTS = {
15    "2020-02-19": "Market Peak",
16    "2020-03-11": "WHO Declares Pandemic",
17    "2020-03-16": "Fed Emergency Rate Cut",
18    "2020-03-23": "Market Bottom",
19    "2020-03-27": "CARES Act Signed",
20}

The study is initialized using the MarketEventStudy API:

 1study = hr.MarketEventStudy(
 2    ticker=TICKERS,
 3    training_start=TRAINING_START,
 4    training_end=TRAINING_END,
 5    analysis_start=ANALYSIS_START,
 6    analysis_end=ANALYSIS_END,
 7    n_states=N_STATES,
 8    key_events=COVID_EVENTS,
 9    output_dir=OUTPUT_DIR,
10    generate_signals=True,
11    signal_strategy='regime_following',
12)
13
14# Run complete analysis
15study.run(
16    create_snapshots=True,
17    create_animations=True,
18    snapshot_window_days=90,
19    animation_fps=5,
20)

Why This Matters

The incremental training approach means our model is adapting in real-time to new market conditions. Yet despite this adaptation, confidence levels still led price action—suggesting that the model’s probabilistic regime assignments capture structural information before it fully manifests in observable price movements.

This is fundamentally different from a static pre-trained model that might simply classify historical regimes. Our model is learning and updating, yet its confidence signals precede the most dramatic price moves.

The January 27 Warning: Confidence Before Carnage

Let’s examine the regime assignments on January 27, 2020—the day the model first showed extreme conviction that something was seriously wrong:

TickerPriceRegimeConfidenceState Probabilities
CCL44.75Crisis99.99%[99.99%, 0.00%, 0.00%]
QQQ210.72Bearish99.95%[99.95%, 0.04%, 0.00%]
DIS133.67Crisis99.67%[0.33%, 0.00%, 99.67%]
WMT35.56Bearish71.44%[2.46%, 71.44%, 26.10%]
AMZN91.42Sideways53.01%[46.59%, 53.01%, 0.39%]

Context: This was January 27. The S&P 500 was only ~3% off its all-time high. The WHO had not yet declared a pandemic. Most investors were unaware of what was coming; there was scant indication of the market carnage that lay ahead.

The Signal: Three assets showed crisis/bearish regimes with >99% confidence. The model wasn’t uncertain—it was decisively warning of structural danger.

Timeline of Events

  • January 27: Model flags crisis (99.99% CCL, 99.95% QQQ confidence)
  • February 19: Market reaches peak (228.96 QQQ, 42.84 CCL)
  • February 24: Crash begins—model at 100% crisis/bearish confidence
  • March 23: Market bottoms (-34% from peak)

The model’s high-confidence warning came 23 days before the peak and 55 days before the bottom.

CCL: When Confidence Leads Price by Weeks

Carnival Cruise Lines provides the most dramatic example of confidence as a leading indicator. As the COVID-19 pandemic devastated the travel industry, CCL stock would eventually fall from over 50 to below 10—a decline of more than 80%.

But the model saw it coming.

The Confidence-Price Divergence

On January 27, with CCL trading at 44.75:

  • Model confidence: 99.99% crisis regime
  • Price action: Still within 15% of all-time highs
  • Market sentiment: Generally bullish, pandemic concerns minimal

By February 19 (market peak), CCL at 42.84:

  • Model confidence: 80.13% bullish (temporary mean reversion)
  • But the damage was done—model had already warned weeks prior

By February 24 (crash begins), CCL at 37.76:

  • Model confidence: 100.0% crisis regime (essentially)
  • Price begins catastrophic decline
  • Model stayed in high-confidence crisis mode for months

Regime Evolution Through Key Moments

The snapshots below show regime detection at critical points during 2020, with confidence bands overlaid on price movements:

CCL at Market Peak
Figure 2a: February 19 - Market peak at 42.84. Model shows bearish regime (51.72% confidence), less certain than QQQ.

CCL at Market Bottom
Figure 2b: March 23 - Market bottom at 12.00. Crisis regime with 80.03% confidence, showing some regime uncertainty.

CCL Recovery Attempt
Figure 2c: March 27 - Failed recovery at 14.41. Back to 100% crisis confidence despite significant price bounce from bottom.

What Made CCL Special

CCL represents the perfect case study because:

  1. Industry Ground Zero: Travel was the first and hardest-hit sector
  2. Extreme Decline: 80%+ Drawdown provided clear signal validation
  3. Extended Crisis: Model maintained high crisis confidence for months (appropriate given prolonged industry shutdown)
  4. Early Detection: 99.99% crisis confidence came while price was still elevated

The key insight: The model’s probabilistic regime assignment captured structural risk before the full price impact materialized.

QQQ: Broad Market Regime Detection

While CCL showed sector-specific crisis detection, QQQ (Nasdaq-100 ETF) demonstrates the model’s ability to detect systematic market regime shifts.

Market Peak Behavior

On February 19, 2020 (market peak), QQQ at 228.96:

  • Model confidence: 95.05% sideways regime
  • This was actually a reasonable assessment—model was cautious but not panicked
  • Contrast with January 27 (99.95% bearish)—model had backed off extreme bearish stance

The Crash: Swift and Decisive

By February 24, QQQ at 213.90:

  • Model confidence: 100.0% bearish (99.999996%)
  • The model went from cautious (sideways) to maximum conviction in days
  • This decisive shift matched the unprecedented speed of the crash

Regime Evolution Through Crisis and Recovery

QQQ at Market Peak
Figure 3a: February 19 - Market peak at 228.96. Sideways regime with 92.63% confidence, showing caution.

QQQ at Market Bottom
Figure 3b: March 23 - Market bottom at 165.05. Crisis regime with 99.99% confidence, maximum conviction.

QQQ Recovery Beginning
Figure 3c: March 27 - Early recovery at 179.41. Still in crisis but showing first signs of regime transition.

Confidence as Market Conviction

The QQQ analysis reveals an important pattern: confidence levels track market conviction, not just price direction.

  • High confidence (>95%) = strong directional conviction
  • Moderate confidence (70-90%) = regime uncertainty, potential transitions
  • Low confidence (<70%) = regime instability, high transition probability

During the crash:

  • Feb 24: 99.9999% bearish (maximum conviction)
  • Throughout March: Maintained >90% crisis/bearish confidence
  • Late March onward: Confidence fluctuations as market sought new regime

This isn’t just classification—it’s a quantitative measure of structural regime stability.

The March 23 Bottom: Detecting the Inflection Point

March 23, 2020 marked the market bottom—the moment when the fastest crash in history reversed. The model’s behavior at this critical inflection point reveals both its strengths and limitations.

Bottom Identification: QQQ vs CCL

On March 23, 2020, both assets hit their lows, but the model treated them very differently:

AssetPriceRegimeConfidenceState Probabilities
QQQ165.05Crisis99.99%Crisis: 99.99%, Bearish: 0.00%, Bullish: 0.00%
CCL12.00Crisis80.03%Crisis: 80.03%, Bearish: 19.76%, Bullish: 0.21%

Key observation: QQQ showed maximum conviction (99.99% crisis), while CCL already exhibited regime uncertainty with 20% probability of transitioning out of crisis. This foreshadowed their divergent recovery patterns.

The First Recovery Signals: March 26-27

Just days after the bottom, the models began to diverge sharply:

March 26 (QQQ +12.5% from bottom, CCL +48.5% from bottom):

  • QQQ: Briefly transitioned to Bullish regime (57.85% confidence)
  • CCL: Remained locked in Crisis regime (100.0% confidence)

March 27 (after some retracement):

  • QQQ: Reverted to Crisis (57.52% confidence) - uncertain regime
  • CCL: Still locked at 100.0% crisis confidence

Critical insight: Despite CCL’s massive 48% one-day bounce from the bottom, the model interpreted this as crisis volatility, not recovery. QQQ’s more gradual 12.5% recovery was correctly identified as a potential regime shift.

Why the Divergence?

The model’s struggle with CCL reveals an important limitation:

  1. Volatility Pattern Recognition:

    • QQQ recovery: Gradual, steady gains → HMM interprets as regime change
    • CCL recovery: Extreme volatility swings → HMM interprets as continued crisis
  2. Statistical Challenge:

    • High-volatility bounces look statistically similar to crisis-regime behavior
    • The model’s Gaussian emissions struggle to distinguish “recovery volatility” from “crisis volatility”
  3. Sector-Specific Dynamics:

    • Travel sector (CCL) had fundamental uncertainty (when will cruises resume?)
    • Broad market (QQQ) had clearer recovery path (Fed intervention, stimulus)

This divergence highlights that regime detection performance varies by asset volatility characteristics—a crucial consideration for practitioners.

Recovery Patterns: Sustained Exit from Crisis

The divergence persisted for months after the bottom:

QQQ Recovery Timeline

  • April 17: First sustained bullish signal (54.30% confidence)
  • May-June: Oscillates between bearish and crisis, but crisis confidence declining
  • July 1: Transitions to sustained bullish regime (63.67% confidence)
  • Timeline: ~3.5 months from bottom to sustained bullish regime

CCL Recovery Timeline

  • April 23-24: First bullish signals (77% confidence), immediately reverts to crisis
  • May 13-29: Remains stuck in crisis despite 33% price gain from bottom
  • June 26: First sustained bullish signals begin
  • Late June-Early July: Finally stabilizes out of crisis regime
  • Timeline: ~3 months from bottom, but significantly more volatile regime transitions

Key finding: The model successfully identified QQQ’s recovery within weeks, but struggled with CCL’s high-volatility recovery pattern for months—even though CCL’s price had already recovered substantially.

The Paradigm Shift: Quantifying Changed Market Dynamics

Beyond individual regime detection, we can quantify whether market behavior fundamentally changed during COVID. The paradigm shift analysis compares regime dynamics between the training period (2018-2019) and the analysis period (2020).

QQQ Paradigm Shift Analysis
Figure 4: Six-panel paradigm shift analysis for QQQ showing how market regime dynamics fundamentally changed during COVID.

Key Findings

1. Transition Matrix Divergence: 0.227

The transition matrices show how regime-to-regime transitions changed:

  • Training period: More stable regime persistence (diagonal dominance)
  • Analysis period: More frequent regime shifts, less predictable transitions
  • Divergence score of 0.227 indicates moderate but significant structural change

2. Volatility Explosion: 1.8x Increase

Daily return Volatility nearly doubled:

  • Training period: 19.8% annualized volatility
  • Analysis period: 35.7% annualized volatility
  • This manifests in the regime structure as shorter, more volatile regime episodes

3. Statistical Validation: KS Test p = 0.0051

The Kolmogorov-Smirnov test confirms that return distributions are statistically different:

  • p-value: 0.0051 (highly significant at α = 0.01)
  • This isn’t just random variation—the market genuinely behaved differently

4. Regime Duration Changes

  • Bearish regime episodes became slightly longer (3.6 → 4.0 days)
  • Sideways regime became much less stable (96% → 89% persistence)
  • Market spent more time in transition states

Practical Implications

The paradigm shift analysis reveals that the model detected not just a regime change, but a fundamental shift in how regimes behave. This is critical for risk management—traditional assumptions about regime persistence and transition probabilities became invalid during COVID.

The model adapted through incremental training, but the paradigm metrics provide quantitative evidence that “this time was different.”

Cross-Asset Confidence Patterns: Sector Rotation Signals

Comparing confidence evolution across different sectors reveals divergent regime patterns that could inform sector rotation strategies:

Early Crisis Detection (January 27)

SectorTickerConfidenceRegimeInterpretation
TravelCCL99.99%CrisisIndustry ground zero—earliest signal
Broad MarketQQQ99.95%BearishSystematic risk detected
EntertainmentDIS99.67%CrisisMixed exposure (parks + streaming)
DefensiveWMT71.44%BearishModerate concern, less conviction
TechAMZN53.01%SidewaysLeast concerned, would become beneficiary

Insight: Confidence divergence across sectors provided early sector rotation signals. Travel showed extreme crisis confidence while tech showed uncertainty—foreshadowing which sectors would collapse versus which would thrive.

Recovery Patterns: Volatility Matters

The recovery period revealed a critical insight: asset volatility characteristics significantly impact regime detection quality.

Asset TypeExampleBottom to BullishRecovery PatternModel Performance
Low VolatilityQQQ, WMT3-4 weeksGradual, steady✓ Excellent detection
Medium VolatilityAMZN, DIS4-6 weeksModerate swings✓ Good detection
High VolatilityCCL3+ monthsExtreme swings✗ Struggled with recovery

Key findings:

  1. QQQ (Broad Market): Model transitioned to bullish within 3-4 weeks of March 23 bottom

    • Recovery pattern: Gradual 12.5% gain → model recognizes regime shift quickly
    • Result: Correct bottom identification, timely recovery signal
  2. CCL (Travel Sector): Model remained in crisis for 3+ months despite 48% one-day bounce

    • Recovery pattern: 48% surge in 1 day → model interprets as crisis volatility
    • Result: Failed to identify bottom, delayed recovery recognition by months
  3. Defensive/Tech Sectors (WMT, AMZN): Intermediate performance

    • More stable than travel, faster regime recognition than high-volatility sectors
    • Model tracked sectoral differences successfully

Practical insight: Sector-specific volatility creates different regime transition dynamics. High-volatility sectors may require adjusted confidence thresholds or longer observation windows to distinguish “recovery volatility” from “crisis volatility.”

Practical Implications for Quantitative Practitioners

1. Confidence Thresholds as Action Triggers

Based on this case study, we propose confidence-based thresholds:

  • >95% confidence: High-conviction regime, actionable signal

    • Example: January 27 CCL (99.99% crisis) = strong sell signal
    • Example: February 24 QQQ (99.9999% bearish) = risk-off positioning
  • 70-95% confidence: Moderate conviction, potential regime transition

    • Example: February 19 QQQ (95.05% sideways) = cautious, wait-and-see
  • <70% confidence: Regime uncertainty, high transition probability

    • Example: January 30 QQQ (60.15% sideways) = unstable regime, avoid strong positions

2. Leading vs. Coincident Indicators

This study demonstrates that confidence metrics can serve as leading indicators:

  • January 27: 99.99% crisis confidence for CCL, 23 days before market peak
  • Confidence spikes preceded the most extreme price moves
  • High confidence doesn’t guarantee immediate price movement, but signals elevated structural risk

This is distinct from traditional technical indicators that tend to be coincident or lagging.

3. Risk Management Applications

Early Warning System: Monitor confidence levels across portfolio holdings

  • Aggregate confidence-weighted regime exposure
  • Alert on >95% bearish/crisis confidence across multiple assets
  • Use as input to position sizing and hedging decisions

Regime-Based Allocation: Adjust portfolio weights based on regime confidence

  • High-confidence bullish: Increase equity exposure
  • High-confidence bearish: Reduce exposure, add hedges
  • Low confidence: Reduce position sizes due to regime instability

4. Sector Rotation Strategy

Cross-asset confidence divergence signals sector rotation opportunities:

  • Compare confidence levels across sectors
  • Rotate out of high-confidence bearish sectors
  • Rotate into low-confidence or bullish sectors
  • Monitor for confidence convergence/divergence patterns

5. Volatility-Adjusted Regime Detection

Key lesson from CCL: Asset volatility characteristics affect regime detection quality. Consider these adjustments:

For High-Volatility Assets (travel, biotech, small caps):

  • Higher confidence thresholds: Require >98% instead of >95% for high conviction
  • Longer observation windows: Wait for 3-5 day regime persistence before acting
  • Volatility normalization: Consider volatility-adjusted returns as HMM inputs
  • Sector-specific models: Train separate HMMs for high-volatility sectors

For Low-Volatility Assets (utilities, broad indices, bonds):

  • Standard thresholds: 95% confidence threshold works well
  • Faster response: Can act on 1-2 day regime signals
  • Regime stability: Lower false positive rate on regime transitions

Detection challenge: CCL’s 48% one-day bounce was misclassified as crisis volatility rather than recovery. This highlights that extreme volatility can mask regime changes—a fundamental limitation of variance-based regime models.

Mitigation strategies:

  • Use state probability distributions, not just argmax regime
  • Monitor probability mass shifts (e.g., CCL’s 20% non-crisis probability on March 23)
  • Combine with fundamental sector analysis for high-volatility assets

6. No Lookahead Bias = Tradeable Signals

The TemporalController guarantee means these signals are immediately tradeable:

  • At any timestamp $t$, confidence values use only data through $t-1$
  • No future information leakage
  • Signals can be exported directly to trading platforms (QuantConnect integration provided)
1# Trading signal generation is built into the framework
2study = hr.MarketEventStudy(
3    # ... configuration ...
4    generate_signals=True,
5    signal_strategy='regime_following',
6)
7
8# Export signals for QuantConnect
9study.export_signals_for_quantconnect()

Technical Implementation Notes

Model Architecture

The study uses a standard 3-state Gaussian HMM:

  • States: Typically interpreted as Bearish (State 0), Sideways (State 1), Bullish (State 2)
  • Observations: Log returns of price data
  • Emissions: Gaussian distributions with state-dependent means and variances
  • Some assets detected additional states (e.g., “Crisis” regime for extreme volatility )

Incremental Training Pipeline

The MarketEventStudy class handles the temporal control automatically:

 1# The study object coordinates:
 2# 1. Data fetching with proper temporal ordering
 3# 2. Initial training on pre-COVID data
 4# 3. Incremental updates at each analysis timestep
 5# 4. Regime inference using only past information
 6# 5. Confidence calculation and visualization
 7
 8study.run(
 9    create_snapshots=True,        # Generate snapshots at key events
10    create_animations=True,       # Create animated regime evolution
11    snapshot_window_days=90,      # 90-day lookback for snapshots
12    animation_fps=5,              # Animation frame rate
13)

Outputs Generated

The framework produces comprehensive analysis outputs:

  1. Regime History CSV: Daily regime assignments with confidence levels
  2. Snapshots PNG: Static visualizations at key event dates
  3. Animations GIF: Full temporal evolution of regimes
  4. Paradigm Shift Analysis: Statistical comparison of regime dynamics
  5. Trading Signals: QuantConnect-compatible signal files

Open Source Implementation

The complete implementation is available as open source:

  • Framework: Hidden Regime Python package
  • Study Code: case_study_covid_2020.py
  • TemporalController: Guarantees no lookahead bias
  • MarketEventStudy API: High-level interface for event-driven analysis

This transparency enables:

  • Full reproducibility of results
  • Audit of temporal control guarantees
  • Extension to other assets, periods, or strategies
  • Community contributions and improvements

Conclusion: Simple Models, Powerful Signals

The COVID-19 market crash provided an unprecedented natural experiment: the fastest decline in market history, creating clear ground truth for regime detection performance.

Key Findings

  1. Early Warning Capability: Model detected crisis regimes with 99.99% confidence three weeks before the market peak (January 27), demonstrating predictive power

  2. Confidence as Leading Indicator: High confidence levels preceded major price moves—CCL showed 99.99% crisis confidence while trading near highs

  3. Bottom Detection Success (QQQ): Successfully identified March 23 bottom with 99.99% crisis confidence, transitioning to bullish regime within 3-4 weeks of recovery

  4. Bottom Detection Challenge (CCL): Failed to recognize recovery for 3+ months—CCL’s 48% one-day bounce was misclassified as crisis volatility rather than recovery

  5. Volatility-Dependent Performance: Model excelled with low-volatility assets (QQQ, WMT) but struggled with high-volatility sectors (CCL, travel), revealing a fundamental limitation

  6. Real-Time Adaptation: Incremental training allowed the model to adapt to changing conditions while maintaining no lookahead bias

  7. Cross-Asset Insights: Confidence divergence across sectors provided early sector rotation signals and revealed sector-specific recovery dynamics

  8. Paradigm Detection: Statistical analysis quantified fundamental changes in market regime dynamics (0.227 divergence, 1.8x volatility increase, KS p=0.0051)

The Broader Message

This case study demonstrates that simple probabilistic models can extract powerful leading signals from market data—with important caveats. A 3-state HMM with Gaussian emissions successfully detected the crash early (QQQ, CCL) and identified the bottom for low-volatility assets (QQQ), but struggled with high-volatility recovery patterns (CCL).

Success factors:

  • Proper temporal control (no lookahead bias via TemporalController)
  • Probabilistic confidence metrics (not just hard regime classifications)
  • Incremental adaptation (learning from new data while respecting causality)
  • Cross-asset analysis (comparing confidence patterns across sectors)

Limitations discovered:

  • Volatility sensitivity: High-volatility assets confuse regime detection during recovery
  • Recovery blind spot: Extreme volatility swings can mask genuine regime transitions
  • Sector-specific calibration needed: One-size-fits-all thresholds don’t work across all asset classes

Practical takeaway: Use HMM regime detection as one input among many. For high-volatility sectors, combine with fundamental analysis, longer observation windows, and adjusted confidence thresholds. The model works best for broad indices and lower-volatility assets where statistical patterns are more stable.

Next Steps

We encourage practitioners to:

  • Explore the open source code and extend the analysis
  • Apply the framework to other assets and time periods
  • Experiment with volatility-adjusted regime detection approaches
  • Test sector-specific model calibrations
  • Develop confidence-based trading strategies that account for asset volatility
  • Contribute improvements to the Hidden Regime framework

The COVID-19 crash demonstrated both the power and the limitations of regime detection. While the model provided early warnings and correctly identified the bottom for QQQ, it struggled with high-volatility recoveries like CCL. Confidence is not certainty—regime detection is a probabilistic tool for risk management, not a crystal ball.


Code and Data: The complete case study code, data outputs, and analysis framework are available as open source. Visit the Hidden Regime GitHub repository to explore the implementation and reproduce these results. The specific case study is available at case_study_covid_2020.py.

QuantConnect Integration: Trading signals generated from this analysis are available in QuantConnect-compatible format, enabling backtesting and further analysis.