This implementation demonstrates the Bayesian network methodology from "Portfolio Management under Stress: A Bayesian-Net Approach to Coherent Asset Allocation" by Riccardo Rebonato and Alexander Denev (Cambridge University Press, 2014).
The examples focuses on modelling black swan events:
- the potential breakup of the Eurozone, and its cascading effects on financial markets ~2010-2012
- Trump's tariffs affecting global trade in 2025
The term Black Swan in the context of financial risk and broader impact was popularized by writer, statistician, and former options trader Nassim Nicholas Taleb.
He extensively discussed the concept in his 2007 book, The Black Swan: The Impact of the Highly Improbable.
According to Taleb, a Black Swan event is an event with three principal attributes:
๐ฆค Rarity (The Outlier): It is an outlier because it lies outside the realm of regular expectations, as nothing in the past definitively points to its possibility. ๐ฃ Extreme Impact: It carries an extreme impact when it occurs, causing widespread and severe consequences across markets, economies, or societies. ๐ฎ Retrospective Predictability: In spite of its outlier status, human nature leads people to invent explanations for it after the fact, making it appear predictable in hindsight (known as hindsight bias).
In finance, these events are particularly dangerous because standard risk models often fail to account for them, leading to massive, unpredictable losses. Examples often cited include the 2008 Global Financial Crisis and the COVID-19 pandemic.
If you'd like to know more about Taleb's other concepts, ๐ต๏ธโโ๏ธ search for Antifragility.
Unlike traditional portfolio management approaches that rely on historical correlations, Rebonato and Denev advocate for:
- Causal Structure: Explicitly modeling how crises propagate through markets
- Forward-Looking Scenarios: Incorporating extreme events that may not be present in historical data
- Expert Judgment: Encoding subjective probabilities based on domain knowledge
- Scenario Analysis: Portfolio optimization under stress conditions, not just "normal times"
The Bayesian network models the following causal relationships:
Political_Instability โโโ
โโโ> Eurozone_Breakup โโ> Credit_Spreads โโ> Corporate_Bonds
Economic_Weakness โโโโโโ โ โ
โ โโโ> Equities
โ โ
โโโ> Flight_to_Quality โโโโค
โ โ
โโโ> Government_Bonds
| Variable | States | Description |
|---|---|---|
| Political_Instability | Low, High | Political tensions within Eurozone |
| Economic_Weakness | Low, High | Economic indicators (GDP, unemployment) |
| Eurozone_Breakup | No, Yes | The Black Swan Event |
| Credit_Spreads | Normal, Widening | Corporate credit spreads |
| Flight_to_Quality | No, Yes | Flight to safe-haven assets |
| Corporate_Bonds | Stable, Falling | Corporate bond performance |
| Government_Bonds | Stable, Rally | Government bond performance |
| Equities | Stable, Falling | Equity market performance |
The implementation uses a custom Bayesian network framework built with:
- NumPy: For numerical computations
- NetworkX: For graph structure
- Matplotlib: For visualization
This avoids heavyweight dependencies like PyTorch while maintaining full functionality.
-
BayesianNetwork Class: Core implementation with:
- Conditional Probability Tables (CPDs)
- Variable elimination for inference
- Forward sampling for Monte Carlo simulation
-
Conditional Probability Distributions: Expert-elicited probabilities reflecting:
- Base rates for political and economic conditions
- Conditional probabilities linking causes to effects
- Severity of market reactions under stress
- Political Instability: Low
- Economic Weakness: Low
- โ Eurozone Breakup probability: 6.7%
- โ Equity decline probability: 22.3%
- Political Instability: High
- Economic Weakness: High
- โ Eurozone Breakup probability: 76.1%
- โ Equity decline probability: 62.0%
- Eurozone Breakup: Yes (observed)
- โ Credit Spreads Widening: 78.6%
- โ Flight to Quality: 88.0%
- โ Corporate Bonds Falling: 73.8%
- โ Government Bonds Rally: 73.3%
- โ Equities Falling: 75.7%
- Credit Spreads: Widening
- Flight to Quality: Yes
- โ Inferred Eurozone Breakup probability: 95.7%
- โ Equity decline probability: 90.0%
Under the black swan scenario (High Political Instability + High Economic Weakness), 10,000 simulations show:
- Eurozone Breakup occurs: 70.5% of scenarios
- When breakup occurs:
- Corporate Bonds fall: 76.7%
- Government Bonds rally: 71.9%
- Equities fall: 77.3%
Traditional Approach (Correlation-Based):
- Uses historical correlations
- Assumes stable relationships
- Fails during regime changes
- Cannot model unprecedented events
Rebonato-Denev Approach (Causal Bayesian):
- Models causal mechanisms
- Incorporates expert judgment about novel scenarios
- Explicitly represents extreme events
- Updates beliefs as new information arrives
Nassim Taleb defined "black swan" events as:
- Rare: Outside the realm of regular expectations
- High Impact: Extreme consequences
- Retrospectively Predictable: After the fact, we rationalize them
The Eurozone breakup scenario exemplifies this:
- Rare: No precedent in modern financial markets (unlike previous currency union dissolutions)
- High Impact: Would affect ~20% of global GDP and โฌ20 trillion in contracts
- Causal Structure: We can reason about how it would unfold, even without historical data
- Stress Testing: Banks and asset managers can model scenarios beyond historical experience
- Portfolio Construction: Allocate assets based on causal understanding, not just correlations
- Risk Management: Quantify tail risks that don't appear in VaR models
- Regulatory Compliance: Meet stress testing requirements with forward-looking scenarios
-
Causality > Correlation: Understanding causal mechanisms helps predict regime changes
-
Expert Judgment is Necessary: For unprecedented events, quantitative models need qualitative input
-
Scenario Diversity: Multiple scenarios (normal, stress, extreme) provide robust portfolios
-
Ambiguity Aversion: Uncertainty about probabilities themselves should affect portfolio choice
-
Dynamic Updates: Bayesian inference allows updating beliefs as new evidence arrives
python rebonato_denev_eurozone_crisis.pyThe script will:
- Build the Bayesian network
- Visualize the causal structure
- Analyze four stress scenarios
- Show portfolio implications
- Run Monte Carlo simulations
- Rebonato, R., & Denev, A. (2014). Portfolio Management under Stress: A Bayesian-Net Approach to Coherent Asset Allocation. Cambridge University Press.
- Rebonato, R. (2012). "A Bayesian Approach to Stress Testing and Scenario Analysis." Journal of Investment Management, 10(4), 19-53.
- Pearl, J. (2009). Causality: Models, Reasoning and Inference. Cambridge University Press.
- Koller, D., & Friedman, N. (2009). Probabilistic Graphical Models: Principles and Techniques. MIT Press.
- Taleb, N. N. (2007). The Black Swan: The Impact of the Highly Improbable. Random House.
Possible extensions to this implementation:
- More Asset Classes: Add commodities, real estate, cryptocurrencies
- Quantitative Returns: Map states to actual return distributions
- Multi-Period Dynamics: Model time evolution of crises
- Learning from Data: Estimate CPDs from historical data where available
- Portfolio Optimization: Implement utility maximization under scenarios
- Ambiguity Aversion: Model uncertainty about probabilities (Ellsberg paradox)
This implementation is educational and demonstrates the core concepts. For production use:
- Consider using established libraries like
pgmpyorPyMC - Validate CPDs with domain experts
- Incorporate real market data
- Add sensitivity analysis
- Consider computational efficiency for large networks
This code is provided for educational purposes. The methodology is described in detail in Rebonato & Denev's book, which should be consulted for rigorous application.
This mini-project POC is part a larger umbrella project: Around the World (of Analytical Modelling) in 81 Repos ๐ - A journey through numerical research, powered by human creativity and AI collaboration
That repo collection is an experiment in rapid numerical research acceleration using the latest LLMs. It demonstrates how humans and AI can collaborate to explore diverse analytical domainsโfrom quantum computing to economics, from statistical mechanics to financial modelling.
