Logo Lanfrica

Jonathanerrils/bayesian-sv-commodity-risk-ghana

Domain:

socioeconomic

Record type:

paper
Creator:
Jon
Host:
# Bayesian Latent Stochastic Volatility Models for Commodity Price Risk in West Africa Code, data pipeline, and paper for a study comparing Bayesian latent stochastic volatility models against standard benchmarks (GARCH, EGARCH, Ornstein-Uhlenbeck, Historical Simulation) for Value-at-Risk and Expected Shortfall forecasting on cocoa, gold, and Brent crude oil — three commodities central to Ghana's economy. The core finding: no single model wins everywhere. Student-t stochastic volatility models achieve a clean sweep of every backtest for both cocoa and gold, with a leverage extension offering a further, smaller improvement for cocoa specifically. Oil resists every specification tested, including the richest one, at the 99% VaR confidence level. The full reasoning is in the paper. ## Repository structure ``` paper/ Full paper (LaTeX source + compiled PDF), Elsevier elsarticle format src/ Model estimation and backtesting code data/raw/ Raw commodity price series (cocoa, gold, oil) plus validation series checkpoints/ Saved rolling-window forecast results per model per commodity outputs/ Backtest result tables and figures notebooks/ Data cleaning, exploratory analysis, and stylised facts (Jupyter) docs/ Data dictionary, cleaning policy, and supporting documentation ``` ## Reproducing this Requirements are in `requirements.txt`. The one dependency worth knowing about ahead of time: fitting the Bayesian SV models via NUTS MCMC is slow — each commodity's full rolling backtest across four SV variants takes somewhere between 10 and 25 hours on a normal laptop, depending on which regime-change periods fall inside the sample. GARCH, EGARCH, and OU are fast by comparison (under 30 minutes for all three commodities together). To run the benchmark models only: ```bash cd src python production_runner.py --benchmark-only ``` To run one commodity's SV models: ```bash python production_runner.py --commodity gold --sv-only `` …