GitHub - mrayanasim09/MarketEquationDiscovery: A spatio-temporal graph neural network framework that can reproduce predictions on inflation contagion across European economies. · GitHub
Skip to content

About

A spatio-temporal graph neural network framework that can reproduce predictions on inflation contagion across European economies.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Predicting Inflation Contagion: A Spatio-Temporal Graph Neural Network Approach to Trade-Linked Economies

Python 3.14 License: MIT DOI ORCID

Rayyan Asim — Independent Researcher
mrayanasim09@gmail.com · Working Paper / Preprint


Abstract

This paper investigates whether explicitly modelling dynamic, directed bilateral trade relationships using Spatio-Temporal Graph Neural Networks (ST-GNNs) improves quarterly CPI inflation (YoY) forecasts for 20 European economies. A prospective expanding-window benchmark spanning 2017Q1–2025Q3 evaluates 13 models across 8 graph adjacency specifications and 3 forecast horizons (h = 1, 2, 4 quarters). The benchmark comprises 39,188 model fits and 783,760 forecast rows, evaluated with RMSE, MAE, sMAPE, CRPS, and 80%/95% prediction interval metrics. Statistical significance is assessed using Harvey-Leybourne-Newbold corrected Diebold-Mariano tests with Bartlett HAC variance, moving-block bootstrap confidence intervals (block = 4, draws = 2,000), and Benjamini-Hochberg FDR correction (q = 0.05).

Key finding: No graph model achieves statistically significant superiority over non-graph baselines across all 20 initialization seeds after FDR correction. The temporal_graph model with an identity_no_trade adjacency (effectively ablating cross-country information) ranks first at h = 2 and h = 4, suggesting that temporal dynamics dominate any trade-network signal at the quarterly horizon.


Research Question

Does explicitly embedding dynamic, directed trade-network structure into a deep learning forecaster improve quarterly CPI inflation predictions for European economies, relative to univariate, multivariate, and non-graph neural network baselines?


Repository Structure

repository/
├── .github/workflows/ci.yml     # GitHub Actions: contract validation + lint + compile
├── docs/                        # Technical documentation (10 guides)
├── experiments/
│   └── results/v2_1/
│       ├── configs/             # Locked benchmark configuration (SHA-256 verified)
│       ├── tuning/              # Validation-only tuning manifest
│       ├── metadata/            # Output hash registry + environment manifest
│       ├── manuscript/          # Tables (TeX + CSV) and figures generated by scripts
│       ├── analysis/            # Aggregated rankings and significance summary CSVs
│       ├── run_manifest.json    # Full execution provenance record
│       └── FINAL_EXPERIMENT_REPORT.md
├── paper/                       # LaTeX manuscript source
│   ├── main.tex
│   ├── appendix.tex
│   ├── references.bib
│   └── figures/
├── src/
│   ├── acquisition/             # Data download (Eurostat Comext, IMF, World Bank)
│   ├── ingestion/               # Parsing and normalisation
│   ├── transform/               # Feature engineering, graph construction, train/val/test splits
│   └── models/
│       ├── graphs/              # 8 adjacency matrix factory variants
│       ├── tuning/              # Validation-only hyperparameter tuning (isolated)
│       ├── run_benchmark_engine_v2_1.py   # Main benchmark orchestrator
│       ├── evaluate_benchmark_engine_v2_1.py  # Metrics + DM tests
│       ├── storage_v2_1.py                # Schema enforcement + transactional writes
│       ├── validate_v2_1_contract.py      # Pre-run protocol gate
│       ├── validate_v2_1_results.py       # Post-run completeness + hash gate
│       ├── analyze_v2_1_results.py        # Rankings and significance summaries
│       ├── generate_v2_1_manuscript.py    # LaTeX tables and figures
│       └── generate_v2_1_report.py        # Final experiment report
├── CHANGELOG.md
├── CITATION.cff
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── ROADMAP.md
├── SECURITY.md
├── environment.yml              # Conda environment spec
├── reproduce.sh                 # End-to-end reproduction script (Unix/macOS)
├── reproduce.ps1                # End-to-end reproduction script (Windows)
└── requirements.txt

Installation

Option A — pip (recommended)

git clone https://github.com/mrayanasim09/MarketEquationDiscovery
cd MarketEquationDiscovery
python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install -r requirements.txt

Option B — Conda

conda env create -f environment.yml
conda activate inflation-gnn

Reproducing the Benchmark

The benchmark outputs (forecasts.parquet, metrics.parquet, dm_tests.parquet) are stored separately (large files). All 5 SHA-256 hashes are registered in experiments/results/v2_1/metadata/output_hashes.json.

Validate the locked contract (< 5 seconds)

python -m src.models.validate_v2_1_contract

Verify existing output hashes (< 30 seconds)

python -m src.models.validate_v2_1_results

Run analysis + manuscript from frozen outputs (< 5 minutes)

python -m src.models.analyze_v2_1_results
python -m src.models.generate_v2_1_manuscript
python -m src.models.generate_v2_1_report

Full end-to-end re-execution (~12 h on Apple Silicon)

# Unix/macOS
./reproduce.sh

# Windows PowerShell
.\reproduce.ps1

Expected wall time: ~12 hours on Apple Silicon M-series; longer on other hardware.
Hardware: CPU execution (no GPU required). 16 GB RAM recommended.


Benchmark Design

Property Value
Target variable Quarterly CPI inflation, YoY (%)
Countries 20 European economies (AUT, BEL, BGR, CYP, CZE, DEU, DNK, EST, FIN, FRA, GRC, HRV, HUN, IRL, ITA, LTU, LUX, LVA, MLT, NLD)
Training window 2011Q2 – 2014Q4
Validation window 2015Q1 – 2016Q4
Prospective test 2017Q1 – 2025Q3 (expanding-window, no look-ahead)
Forecast horizons h = 1, 2, 4 quarters ahead
Neural seeds 20 (seeds 42 – 61)
Total model fits 39,188
Total forecast rows 783,760

Models

Category Model
Naïve / statistical persistence, ARIMA, VAR, ETS, dynamic_factor
Machine learning ridge, gradient_boosting
Deep learning (non-graph) MLP, LSTM, TCN
Graph neural networks GCN, temporal_graph

Graph Adjacency Variants

Variant Description
directed_trade Raw directed quarterly bilateral trade volumes
log_trade Log-transformed trade volumes
import_dependence Trade normalised by importer's total imports
top_k_incoming Retain only top-k trade partners per country
reversed Transposed network (export → import direction)
undirected Symmetrised trade relationships
degree_preserving_random Null model: random edges preserving degree sequence
identity_no_trade Identity matrix — ablates all cross-country signal

Evaluation Metrics

Metric Type
RMSE Point — primary
MAE Point — primary
sMAPE Point — scale-free
CRPS Probabilistic — sharpness + calibration
Coverage 80% / 95% Probabilistic — calibration
Width 80% / 95% Probabilistic — sharpness

Statistical testing: Harvey-Leybourne-Newbold DM test · Bartlett HAC · Moving-block bootstrap CI (block=4, draws=2000) · Benjamini-Hochberg FDR (q=0.05)


Data Sources

Source Data
Eurostat Comext Quarterly bilateral trade flows
IMF IFS CPI, interest rates, exchange rates
World Bank GDP growth, energy prices

All data are from public sources; no proprietary datasets were used.


Documentation

Document Description
docs/OVERVIEW.md Project overview and motivation
docs/BENCHMARK_PROTOCOL.md Full benchmark protocol specification
docs/REPRODUCIBILITY.md Step-by-step reproduction guide
docs/RESULTS_GUIDE.md Interpreting parquet output schemas
docs/ARCHITECTURE.md Code architecture and data pipeline
docs/DATA_DESCRIPTION.md Dataset documentation
docs/GRAPH_MODELS.md GCN and temporal-graph architecture details
docs/STATISTICAL_TESTS.md Statistical testing methodology
docs/LIMITATIONS.md Known limitations and scope
docs/FAQ.md Frequently asked questions

Citation

@article{asim2026predicting,
  title   = {Predicting Inflation Contagion: A Spatio-Temporal Graph Neural
             Network Approach to Trade-Linked Economies},
  author  = {Asim, Rayyan},
  journal = {Preprint / Working Paper},
  year    = {2026},
  doi     = {10.2139/ssrn.7009041},
  url     = {https://doi.org/10.2139/ssrn.7009041}
}

License

This project is licensed under the MIT License — see LICENSE for details.

Acknowledgements

Data provided by Eurostat, the International Monetary Fund, and the World Bank. No external funding was received for this research.

About

A spatio-temporal graph neural network framework that can reproduce predictions on inflation contagion across European economies.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages