Skip to main content

PyConnectedness logo

PyConnectedness

Status: active development License: GPLv3+ Python 3.10+

⚠️ Active development. This library is currently under active development. The API and project structure may still change as additional connectedness and dependence methods are added.

About

PyConnectedness is a Python library for analysing connectedness, spillovers and dependence in multivariate (time series) data. The current implementation focuses on variance-decomposition-based connectedness measures in the spirit of Diebold and Yilmaz (2009, 2012, 2014), including static and rolling-window dynamic connectedness, directional spillovers, net spillovers, net pairwise directional connectedness, and graphical representations of connectedness networks. Additionally, the package implements the frequency-domain connectedness framework of Baruník and Křehlík (2018), allowing connectedness to be decomposed across different frequency bands and time horizons. A max-linear Bayesian network module is additionally in progress, aiming to extend the package towards modelling extremal dependence and causal structures between extreme events. The goal is to bring methods that are well established in econometrics, statistics and applied mathematics, but still scattered or missing in Python, into one open-source package.

Project status

Implemented

  • Connectedness and spillover analysis
    Static and rolling-window dynamic connectedness, directional TO and FROM, net and pairwise_net directional connectedness.

  • Visualisation Spillover heatmaps and directed connectedness networks.

  • Frequency-domain connectedness
    Analysis of spillovers across different time horizons.

In progress

  • Max-linear Bayesian networks Modelling extremal dependence and causal structures between extreme events.

  • Animations Animated heatmaps, networks and time series (next release)

Installation

PyConnectedness requires Python 3.10 or newer.

Install from PyPI:

pip install pyconnectedness

Usage

PyConnectedness provides a compact interface for estimating VAR-based connectedness measures.

A static connectedness estimate can be computed directly from a pandas DataFrame using a simple one-liner:

from pyconnectedness import static_connectedness

result = static_connectedness(
    data,
    horizon=10,
    method="generalized",
    lags=2,
)

print(result.table)
print(result.total)
print(result.directional_to)
print(result.directional_from)
print(result.net)
print(result.pairwise_net)

For Diebold-Yilmaz (2009) - an orthogonalized Cholesky variance decomposition can be used:

result = static_connectedness(
    data,
    horizon=10,
    method="orthogonalized",
    lags=2,
)

Rolling-window connectedness is available through:

from pyconnectedness import dynamic_connectedness

dynamic = dynamic_connectedness(
    data,
    window=200,
    horizon=10,
    method="generalized",
    lags=2,
)

print(dynamic.total)
print(dynamic.net)

Frequency connectedness splits the spillover table into bands:

from pyconnectedness import frequency_connectedness

frequency = frequency_connectedness(
    data,
    horizon=100,
    periods=(5, 20),
    method="generalized",
    lags=4,
)

print(frequency.total)
print(frequency.within)
print(frequency.share)

The package currently provides:

  • VAR estimation and moving-average representations
  • orthogonalized forecast error variance decomposition
  • generalized forecast error variance decomposition
  • static connectedness measures
  • rolling-window dynamic connectedness
  • total connectedness
  • directional TO and FROM measures
  • net directional connectedness
  • net pairwise directional connectedness
  • frequency-domain connectedness
  • within-frequency connectedness
  • spillover heatmaps
  • directed connectedness networks

Preview: animations (next release)

The next version will add animated versions of the figures, built up step by step, or played back one rolling window per frame.

For complete examples, see the replication notebooks below.

Replication of Diebold-Yilmaz papers

The examples/ directory contains end-to-end replications of the main Diebold-Yilmaz connectedness frameworks using the PyConnectedness package, providing reproducible examples and validation against published results.

Diebold-Yilmaz (2009)

The DY-2009 replication uses the orthogonalized, Cholesky-based variance decomposition and reproduces the static and dynamic spillover analysis using the original framework.

Source notebook:

examples/replicate_dy2009.ipynb

Or with Colab: Open in Colab

Diebold-Yilmaz (2012)

The DY-2012 replication uses the generalized forecast error variance decomposition and the corresponding row-normalized connectedness framework.

Source notebook:

examples/replicate_dy2012.ipynb

These notebooks also serve as reproducible usage examples for the package.

Repository structure

pyconnectedness/
├── README.md
├── LICENSE                     # GPLv3
├── pyproject.toml              # packaging & dependencies
├── .gitignore
├── .github/
│   └── workflows/
│       └── tests.yml           # continuous integration
├── src/
│   └── pyconnectedness/        # the library source code
│       ├── __init__.py
│       ├── connectedness/      # Diebold-Yilmaz spillover measures
│       ├── causality/          # max-linear Bayesian networks (in development)
│       └── viz/                # network plotting
├── tests/                      # unit tests
├── examples/                   # example notebooks
├── CITATION.cff                # citation
└── logos/                      # project & funding logos

References

The methods draw on, among others:

  • Diebold and Yilmaz (2009, 2012, 2014) for variance-decomposition-based connectedness and spillover measures
  • Baruník and Křehlík (2018) for frequency-domain connectedness
  • Gissibl and Klüppelberg (2018) for max-linear models on directed acyclic graphs

(Reference list to be completed as the modules are implemented.)

Data

The data files in this directory are used for replication and validation of the connectedness measures implemented in PyConnectedness.

Diebold-Yilmaz (2009)

The files

  • dy2009_returns.xlsx
  • dy2009_vola.xlsx

are based on the DY2009 data distributed with:

Nguyen, Viet Hoang; Kocenda, Evzen; Greenwood-Nimmo, Matthew (2024), "Detecting Statistically Significant Changes in Connectedness: A Bootstrap-based Technique", Mendeley Data, V1.

DOI: https://doi.org/10.17632/rtwsfgpgmf.1

Diebold-Yilmaz (2012)

The file

  • dy2012_vola.xlsx

is based on the replication material available from:

Doan, Tom (2025), "DIEBOLDYILMAZ_IJF2012: RATS program to replicate Diebold and Yilmaz (2012) spillover calculations."

EconPapers: https://econpapers.repec.org/software/bocbocode/rtz00199.htm

Funding

Developed with support from the Prototype Fund (Software Sprint), funded by the German Federal Ministry of Research, Technology and Space (BMFTR) and supported by the Open Knowledge Foundation Deutschland.

Prototype Fund BMFTR

License

Released under the GNU General Public License v3.0 or later.

Release files for pyconnectedness 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyconnectedness 0.1.0
File Size Uploaded
pyconnectedness-0.1.0.tar.gz 2.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyconnectedness 0.1.0
File Interpreter ABI Platform
pyconnectedness-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / pyconnectedness-0.1.0.tar.gz

Download URL pyconnectedness-0.1.0.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
6ec6139f6e82a80b94cfaa4dfeaa499620057fafcd45c696dafd280ddf7cb193
BLAKE2b-256 checksum
How to use checksums
da641916f31e8db7e0ddac91a1f9c171e630aa4efcb57c21e9b7d612ae53128c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / pyconnectedness-0.1.0-py3-none-any.whl

Download URL pyconnectedness-0.1.0-py3-none-any.whl
Size 32.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
daa3ac579ea43542337fd53cebe44abf3597ed0754938ec72cf10c815cfe5bcf
BLAKE2b-256 checksum
How to use checksums
49e9cc4e29574d1e4c38d14278c06f1651b72ef143a0e16509a73505b025fab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page