Skip to main content

pymgarch

CI/CD PyPI Python Downloads codecov Docs License: MIT

Multivariate GARCH for Python: DCC, ADCC, and CCC correlation dynamics built on top of arch univariate marginals, validated against R's rmgarch/tsmarch.

Why

Python has no maintained general-purpose multivariate GARCH framework. The existing packages cover Gaussian DCC(1,1) at most, while R users have had DCC, ADCC, GO-GARCH and copula-GARCH in rmgarch (now tsmarch) for a decade. pymgarch closes that gap incrementally, starting with the correlation layer:

  • stage 1 (univariate volatility) is delegated to arch, the ecosystem's dominant, battle-tested GARCH package;
  • stage 2 (correlation dynamics) is what this library implements, with correct two-stage Engle-Sheppard standard errors and replication tests against rmgarch's fitted parameters and likelihoods.

Install

pip install pymgarch          # or: pip install pymgarch[numba]

The optional numba extra JIT-compiles the correlation recursions; without it everything runs in pure NumPy.

Quickstart

import pymgarch as mg

# returns: (T, N) DataFrame, percent scale recommended
res = mg.DCC(dist="t").fit(returns)
print(res.summary())

res.conditional_correlations   # (T, N, N)
res.conditional_covariances    # (T, N, N)

fc = res.forecast(horizon=10)                    # analytic
fc = res.forecast(horizon=10, method="simulation", n_paths=2000)
flt = res.filter(new_returns)                    # fixed params, new data

Marginals default to constant-mean GARCH(1,1). Customize per-column via a spec, or bring your own fitted arch results:

spec = mg.UnivariateSpec(vol="GARCH", p=1, o=1, q=1, dist="t")  # GJR-t
res = mg.ADCC().fit(returns, marginals=spec)

from arch import arch_model
fitted = [arch_model(returns[c], rescale=False).fit(disp="off") for c in returns]
res = mg.DCC().fit(returns, marginals=fitted)

Models (v0.1)

Model Distribution Estimation
CCC (Bollerslev 1990) Gaussian closed form given marginals
DCC(1,1) (Engle 2002) Gaussian, Student-t two-stage QML, correlation targeting
ADCC (Cappiello-Engle-Sheppard 2006) Gaussian, Student-t two-stage QML, PSD-constrained targeting
GO-GARCH (van der Weide 2002) Gaussian or t factors fastICA rotation + univariate factor fits
Copula-GARCH (Patton 2006) Gaussian or t copula, static or DCC two-stage QML, parametric or empirical margins
Scalar/diagonal BEKK (Engle-Kroner 1995) Gaussian direct QML with variance targeting

For large cross-sections, DCC and ADCC accept method="composite" (Engle- Shephard-Sheppard pairwise composite likelihood), replacing the N-dimensional likelihood with O(N) bivariate recursions for the default contiguous pairs (O(N^2) with pairs="all").

Standard errors: the correlation-family models (DCC/ADCC/copula) use Engle-Sheppard (2001) two-stage sandwich estimates -- marginal and correlation scores stacked so stage-2 uncertainty reflects stage-1 estimation error, with correlation targets held fixed (the same approximation rmgarch makes); if the stacked system is singular the library falls back to a stage-2-only sandwich and says so in summary(). Composite fits report Godambe-sandwich SEs labelled composite-godambe. BEKK is estimated in a single stage, so its SEs are a plain QML sandwich (qml-robust) that additionally holds the estimated mean and targeting covariance fixed; on boundary or degenerate optima it degrades to NaN SEs with a warning instead of failing the fit.

License

MIT

Metadata

Release files for pymgarch 0.5.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 pymgarch 0.5.0
File Size Uploaded Provenance Actions
pymgarch-0.5.0.tar.gz 734.2 kB With provenance Details for pymgarch-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 784.0 kB

Release files / pymgarch-0.5.0.tar.gz

Download URL pymgarch-0.5.0.tar.gz
Size 734.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d6a7d070aaf7214c378fd37cf5d4192ae309569cae887549ac5c9710b84b32ea
BLAKE2b-256 checksum
How to use checksums
bd624eff55ec106ddc5b0a634ee93d5f6385e085d90b1c122065c99746f18000
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 Oct 5, 2026.

Transparency log

Release files / pymgarch-0.5.0-py3-none-any.whl

Download URL pymgarch-0.5.0-py3-none-any.whl
Size 49.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75cd89015ad89d63f00db2334efc6474d5e115c47ba11ba70930052ed3c2397c
BLAKE2b-256 checksum
How to use checksums
fec7e26a4ce3eec7cdf47ce254e243a22a5aeaa5676504bb803dfcd85c0918cb
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 Oct 5, 2026.

Transparency log

Security for pymgarch 0.5.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pymgarch-0.5.0.tar.gz

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 Oct 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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