feat(multivariate): add CCC-GARCH and DCC-GARCH -- closes #242#854
Open
hass-nation wants to merge 1 commit into
Open
feat(multivariate): add CCC-GARCH and DCC-GARCH -- closes #242#854hass-nation wants to merge 1 commit into
hass-nation wants to merge 1 commit into
Conversation
Implements the two multivariate GARCH models most commonly used in empirical finance, closing the long-standing tracking issue bashtage#242. CCC-GARCH (Bollerslev 1990) - Constant conditional correlation: H_t = D_t R̄ D_t - R̄ estimated as sample correlation of standardised residuals - Two-step QMLE following Engle & Sheppard (2001) DCC-GARCH (Engle 2002) - Dynamic correlation: Q_t = (1-α-β)Q̄ + α ε_{t-1}ε'_{t-1} + β Q_{t-1} - R_t = diag(Q_t)^{-½} Q_t diag(Q_t)^{-½} - Two-step QMLE: marginal GARCH(p,q) first, then DCC params (α,β) - Persistence property: α+β < 1; half-life of correlation shocks - SLSQP optimisation with stationarity constraint Both models - Accept p, q, dist ('normal','t','skewt','ged') for marginal GARCH - Return conditional covariance/correlation matrices (T, n, n) - Result objects: loglikelihood, AIC, BIC, summary(), forecast() - Forecasts: h-step-ahead H_t (DCC correlations revert to Q̄) - Positive-definite guarantees throughout (eigenvalue flooring) - DCCResult.plot_correlations() for matplotlib visualisation - simulate_dcc() utility for generating DCC-distributed returns Tests: 110 tests across 10 test classes, 0 failures Existing tests: 4930 passed, 0 regressions References Bollerslev (1990). Rev. Econ. Stat., 72(3), 498-505. Engle (2002). JBES, 20(3), 339-350. Engle & Sheppard (2001). NBER WP 8554. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #854 +/- ##
==========================================
- Coverage 99.54% 94.53% -5.02%
==========================================
Files 78 81 +3
Lines 15818 16662 +844
Branches 1294 1348 +54
==========================================
+ Hits 15746 15751 +5
- Misses 38 877 +839
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
arch.multivariate— a new subpackage providing the two multivariate GARCH models most commonly requested by users, closing the tracking issue opened in 2018 (#242).Models
CCC-GARCH (Bollerslev 1990)
Constant Conditional Correlation: H_t = D_t R_bar D_t where D_t = diag(sigma_{1,t}, ..., sigma_{n,t}) and R_bar is estimated from sample correlations of standardised residuals.
DCC-GARCH (Engle 2002)
Dynamic Conditional Correlation:
Q_t = (1-alpha-beta) Q_bar + alpha * eps_{t-1} eps_{t-1}' + beta * Q_{t-1}
R_t = diag(Q_t)^{-1/2} Q_t diag(Q_t)^{-1/2}, H_t = D_t R_t D_t
Both models fit each marginal series with an independent
archGARCH(p,q) first (two-step QMLE, Engle & Sheppard 2001), then estimate the correlation parameters — so all ofarch's existing univariate infrastructure (distributions, lag orders, forecasting) is reused.New Public API
Design decisions
arch_model()— all distributions, lag orders, rescaling, and convergence warnings work out of the boxFiles added
arch/multivariate/__init__.pyarch/multivariate/dcc.pysimulate_dcc(~700 lines)arch/tests/multivariate/__init__.pyarch/tests/multivariate/test_dcc.pyTests
Test coverage includes: helper functions (
_nearest_pd,_dcc_recursion,_dcc_loglikelihood), model instantiation and validation, result properties (shapes, positive-definiteness, symmetry, unit diagonal), forecast shapes and long-horizon convergence, statistical correctness (correlation recovery, regime-change detection),simulate_dcc, and imports/exports.References
Closes #242
Generated with Claude Code