Bayesian Multivariate GARCH Models
Overview
Fit Bayesian multivariate GARCH models using 'Stan' for full Bayesian inference. Generate (weighted) forecasts for means, variances (volatility) and correlations. Currently DCC(P,Q), CCC(P,Q), pdBEKK(P,Q), and BEKK(P,Q) parameterizations are implemented, alongside a constant covariance baseline (that can be used for testing whether GARCH is warranted), based either on a multivariate gaussian normal or student-t distribution. DCC and CCC models are based on Engle (2002) doi:10.1198/073500102288618487 and Bollerslev (1990). The BEKK parameterization follows Engle and Kroner (1995) doi:10.1017/S0266466600009063 while the pdBEKK as well as the estimation approach for this package is described in Rast et al. (2020) doi:10.31234/osf.io/j57pk. The fitted models contain 'rstan' objects and can be examined with 'rstan' functions.
cmdstanr backend support
bmgarch()now acceptsbackend = "cmdstanr"in addition to the default"rstan". Both MCMC (NUTS) and variational Bayes (sampling_algorithm = "VB") are supported with the new backend.summary(),print(),plot(),forecast(),fitted(),loo(), andmodel_weights()all work with cmdstanr-fitted objects.- Stan function
a_b_scale_jacobianrenamed toa_b_scale_log_jacto avoid a future name collision with Stan 2.39's reserved_jacobiansuffix (affectsinst/stan/functions/jacobian.stan). - The
iterationsargument now defaults to2000for MCMC and30000for VB when left unspecified. Previously the single default of2000was too low for ADVI gradient ascent.
Show all changes in 2.1.0Hide the rest of the changes in 2.1.0
- The
backendfield is stored in everybmgarchobject so thatloo()refits and other operations that call back intobmgarch()automatically use the same backend. - Threading defaults: cmdstanr models compiled with
stan_threads = TRUEnow default tothreads_per_chain = 1(MCMC) andthreads = 1(VB). Users can override via....
Bug fixes
- Fixed ensemble covariance underestimation in
.weighted_samples(). The between-model variance term required by the law of total variance,Σ_m w_m (μ̂_m − μ̂_mix)(μ̂_m − μ̂_mix)ᵀ, is now added to the weighted combination ofHandH_forecasted. This corrects the ensemble posterior predictive covariance for both backcasts and forecasts whenever models with differing mean structures are combined. The fix is a no-op for single-model objects. model_weights()andloo()now work with cmdstanr objects:log_likextraction and chain/iteration metadata no longer rely on rstan S4 slot access (@sim).- Weighted forecasts (
forecast(..., weights = mw)) now work with cmdstanr backends via a new.extract_param_list()helper that replicatesrstan::extract()output for cmdstanr draw objects. - Forecast draws passed to
rstan::gqs()are now correctly extracted viaposterior::as_draws_matrix()for cmdstanr fits, fixing a "no dimnames" error.
Tests
- Added
tests/testthat/test-backends.Rcoveringsummary,forecast, andmodel_weightsfor all three combinations: rstan/MCMC, cmdstanr/MCMC, and cmdstanr/VB on a CCC model.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-07-29
- ERROR12 OK, 1 ERROR2026-07-27
- OK13 OK2026-05-28
Show 3 earlier changesHide 3 earlier changes
- NOTE14 NOTE2026-04-22
- ERROR13 NOTE, 1 ERROR2026-04-18
- NOTE14 NOTE2026-03-10
Documentation
- Help pages
- 44 (26 internal)includes a package overview page
- Examples that run
- 0%5 never run
- Exported functions with examples
- 80%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 9% with a bibliography file
Downloads
Repository
- PRs merged (all time)
- 94%
- Median days to close, 50 most recently updated closed issues
- 8
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
8 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/ph-rast/bmgarch on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows
Show all practicesHide 1 practice
Dependencies
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 2.1.0Latest
- RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- 2.0.02023-09-12 · diff ↗
- RR 4.3.0 released · 2023-04-21
- RR 4.2.0 released · 2022-04-22
- 1.1.02021-12-14 · diff ↗
- 1.0.12021-06-14 · diff ↗
- RR 4.1.0 released · 2021-05-18
- 1.0.02020-09-17
- RR 4.0.0 released · 2020-04-24
Package metadata
- First published
- 2020-09-17
- Total releases
- 5 / 6 yrs
- License
- GPL (>= 3) OSI
- Additional repositories
- stan-dev.r-universe.dev
- Minimum R
- ≥ 4.0.0
- Bundled data
- 40 KB / 2 files
- Download size
- 208 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("bmgarch")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.