Skip to content

bayesGARCH

2.2.0Package record

Bayesian Estimation of the GARCH(1,1) Model with Student-t Innovations

0packages dependsuggested by 1
5.4Kdownloads / year
94.1%test coverage
13/13flavors OK

Overview

About
Maintained by David ArdiaCRAN page ↗GitHub ↗Issues ↗Declared funder: David Ardia

Provides the bayesGARCH() function which performs the Bayesian estimation of the GARCH(1,1) model with Student's t innovations as described in Ardia (2008) doi:10.1007/978-3-540-78657-3.

Changes in 2.2.0
  • BUG FIX, AFFECTS RESULTS: 'control$addPriorConditions' now enters the acceptance test of each Metropolis-Hastings step instead of being applied once to the whole block. The previous scheme accepted or rejected the entire sweep on the final value of psi. Each sub-step is reversible with respect to the unconstrained posterior, but their composition is only invariant, not reversible, so rejecting the block did not leave the constrained posterior p(psi|y) I[psi in A] invariant and the chain converged to the wrong distribution. On the dem2gbp benchmark under the covariance-stationarity constraint alpha1 + beta < 1, the posterior mean of alpha0 was overstated by about 60% and that of alpha1 by about 35%. Users who called bayesGARCH() with 'addPriorConditions' should re-run. Runs WITHOUT 'addPriorConditions' target the same posterior as before and need not be revisited; see the note on numerical changes below for why they are nonetheless no longer reproduced bit for bit from a given seed.
Show all changes in 2.2.0Hide the rest of the changes in 2.2.0
  • BUG FIX, AFFECTS RESULTS: the series is now rescaled internally to unit root mean square and the draws are mapped back, so that results no longer depend on the units of 'y'. The proposals are built from a weighted least squares fit whose conditioning depends on the size of y^2 relative to alpha0, and whose starting value for alpha0 was a fixed 0.01. On a series whose scale was far from unity every alpha and beta move was rejected: the move rates were exactly zero, nu was then dragged down to delta, the latent variances collapsed, and the root solved in the nu update eventually left its bracket and aborted the run. Dividing a series by 100 -- log-returns in decimals rather than in percent -- was enough to trigger it. Only alpha0 carries the scale, and the Normal prior on alpha transforms exactly under the map, so the posterior explored is unchanged; the factor is a power of two, which makes the rescaling and its inverse exact. Note that the prior is stated in the units of 'y': rescaling 'y' without rescaling 'Sigma.alpha' changes the posterior, as it should.
  • BUG FIX: the rejection-envelope rate of the nu update was solved on the fixed interval [1e-5, 500]. The root can lie above 500, for a sharply concentrated prior on nu such as lambda = 500 with delta = 500. The bracket is now widened geometrically until the endpoints differ in sign, and a failure to bracket is reported with a message naming the state instead of surfacing as 'f() values at end points not of opposite sign'.
  • BUG FIX: 'control$addPriorConditions' is now validated identically wherever it is called. The starting values were checked with isTRUE() while proposed states were tested directly, so a function returning a truthy number such as 1 was refused up front although the sampler would have accepted it, and a function returning NA only at some proposed states aborted the chain mid-run with 'missing value where TRUE/FALSE needed'. Both now give one message naming the offending parameter vector.
  • Prior variances too concentrated to invert are refused with a clear message: 'Sigma.beta' and 'lambda' whose reciprocals overflow, and a 'Sigma.alpha' that cannot be inverted. 'Sigma.alpha' is inverted in the units of 'y', where it is well conditioned, and the precision is then mapped to the rescaled units.
  • The symmetry of 'Sigma.alpha' is judged to tolerance rather than by exact floating-point equality, so a matrix whose off-diagonal entries are arithmetically equal but not bit-identical is accepted; it is symmetrised before use. Genuinely asymmetric matrices are still refused.
  • A series on a scale that cannot be represented after squaring is refused with a clear message rather than failing inside a Cholesky factorisation or returning a chain that never moves.
  • BUG FIX, AFFECTS RESULTS: starting values are now required to lie in the support of the posterior, and are rejected with an error naming the row and the failed condition otherwise. Every Metropolis-Hastings step only accepts a move into the admissible region, so a chain started outside it could never enter: the starting value was returned unchanged at every iteration and the whole sample consisted of draws the posterior gives zero mass, with no warning. A chain started at alpha1 + beta = 1.3 under the covariance stationarity constraint returned 200 identical inadmissible draws out of 200. This was easy to trigger by accident, since the documented advice to start from the parameters of a previous estimation step supplies an unconstrained estimate; on the dem2gbp benchmark the unconstrained posterior puts 62% of its mass outside the covariance stationary region.
  • BUG FIX: the nu step tested 'control$addPriorConditions' inside its accept-reject loop, so it exhausted all 50000 proposals whenever no value of nu could satisfy the condition, which is the usual case since conditions such as alpha1 + beta < 1 do not involve nu. The draw is now taken from the full conditional first and the condition applied once afterwards, as an independence Metropolis-Hastings step whose ratio reduces to the indicator. This is equivalent when the condition is satisfiable and roughly thirty times faster when it is not.
  • The default starting value for nu is now the prior mean, delta + 1/lambda, rather than a fixed 100. The fixed value lay below the prior support for the Normal special case documented under 'lambda = 100, delta = 500'.
  • Unknown components of 'control' are now rejected rather than silently ignored, so that a mistyped name is reported instead of leaving the default in force. The internal 'hypers' component is no longer reachable through 'control'; it could be used to replace hyper-parameters that had already been validated as arguments of bayesGARCH().
  • 'y' and all hyper-parameters must now be finite. In particular 'Sigma.beta = Inf' was previously accepted and silently imposed an improper prior; other non-finite inputs failed later with implementation-level messages from .C() or uniroot().
  • 'control$l.chain', 'control$n.chain', 'control$refresh' and 'control$digits' must now be finite whole numbers. Fractional values were silently truncated, and NA values failed inside the sampling loop or printed meaningless progress reports.
  • formSmpl() now requires a non-empty list of matrices sharing the same dimensions and column names, and whole-number 'l.bi' and 'batch.size'. In particular 'batch.size = Inf' previously returned a single row of NA rather than signalling an error.
  • BUG FIX: supplying 'control$n.chain' together with a 'control$start.val' matrix of several rows failed with "length of 'dimnames' [2] not equal to array extent". Several rows are now used as documented (one per chain), a single row or a vector is replicated across chains, and a mismatch between the two is reported clearly.
  • BUG FIX: formSmpl() validated the length of 'l.bi' where it meant 'batch.size'.
  • BUG FIX: a non-finite Metropolis-Hastings ratio, which can arise when two log posterior evaluations are both -Inf, made the acceptance test NA and aborted the chain. Such a proposal is now rejected.
  • BUG FIX: fixed a potential out-of-bounds write in the simulation branch of the C variance recursion. It was unreachable from R, where 'sim' is always zero.
  • 'control$l.chain' and 'control$n.chain' are now validated. A 'l.chain' of 1 previously wrote past the end of the chain.
  • 'y' may now be any numeric vector, including a 'ts' or 'zoo' series, which the previous is.vector() test rejected.
  • Progress reports use message() rather than cat(), so they can be silenced with suppressMessages(). This applies to bayesGARCH() and formSmpl().
  • Each chain of the returned mcmc.list carries a "move.rates" attribute giving the proportion of iterations at which each parameter moved. A high rate is not by itself evidence of good mixing: the accepted moves are typically small and the chains are strongly autocorrelated.
  • The returned object is built with coda::mcmc.list() rather than by setting the class attribute directly.
  • SPEED: about a quarter less time per iteration. mvtnorm::dmvnorm() and mvtnorm::rmvnorm(method = "eigen") were replaced, in the alpha step only, by internal equivalents that perform the same operations in the same order without the argument checking and dispatch that dominated their cost at p = 2; these are exact substitutes, and tests pin them against mvtnorm. The w and alpha steps now share one evaluation of the conditional variance instead of computing it twice, and the Gamma shape in the w step is no longer expanded into a vector of identical values. Neither of those changes the arithmetic.
  • NUMERICS, changes the low-order bits of the draws: fn.Dd.D() now forms the weighted cross-products from the whitened regressors Z := X/sqrt(h), through crossprod(), rather than from X/h through t(X/h) %*% X. Both compute X' diag(1/h) X. The new form is symmetric by construction, about five times closer to the exactly rounded value for that matrix, and about an order of magnitude closer for the cross-products of the beta step, whose regressors change sign. The posterior precision is then inverted through its Cholesky factor rather than by a general LU solve, which is both faster and, unlike solve(), returns an exactly symmetric D. That removes a latent inconsistency: D is handed to chol(), which reads its upper triangle, and to eigen(symmetric = TRUE), which reads its lower one, so an asymmetric D meant the covariance used to draw the candidate and the covariance used to evaluate its density differed in their last bits. The posterior being targeted is unchanged, but a given seed no longer reproduces the draws of version 2.1.10 exactly.
  • mvtnorm moved from Imports to Suggests, where it is now used only to test the equivalence above.
  • Documented the corrected handling of 'addPriorConditions'.
  • Documentation fix: the default 'control$start.val' was documented as c(0.01,0.1,0.7,20); the code uses c(0.01,0.1,0.7,100).
  • Documentation fix: replaced the claims about the sampler's speed and mixing with a measured statement. The cost per iteration is modest on current hardware, but the default l.chain=10000 yields an effective sample size of only a few hundred draws per parameter on dem2gbp. Readers are pointed at coda::effectiveSize() and coda::gelman.diag().
  • CITATION file updated to bibentry(); citEntry() and personList() are deprecated.
  • Added a testthat suite. The statistical checks, namely the dem2gbp Normal benchmark and a regression test pinning the constrained posterior to an independently obtained reference, are skipped on CRAN.
  • Removed cvGARCH(), which was never exported, documented or called, and the C routines fnFilterAlphaAsymC() and fnFilterWAsymC(), which were neither registered nor called.
  • mvtnorm and coda functions are now consistently namespace-qualified.
  • DESCRIPTION: dropped the CRAN-generated Author and Repository fields and a RoxygenNote entry for a package that uses no roxygen; added Encoding and the 'fnd' role for the author.

From NEWS in the release

Install

Health

CRAN checks
13OK
Slowest check: 2.2 min · r-devel-windows-x86_64
Status changes
  • OK13 OK2026-08-26
  • NOTE12 OK, 2 NOTE2026-03-10
Advisories

none known

Documentation

In release 2.2.0
READMEYes · 174 wordsVignettesNoNEWSYes · 0% structured · mentions 2.2.0Citation fileYes · cites a publicationWebsitenot declared in DESCRIPTION
Cites an R Journal article
Help pages
3
Examples that run
100%2 run in a plain check
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
67%

Downloads

5.4K
CRAN downloads in the past year
Rank #4,754 · ~15/day · ~448/mo
Daily download trend is not available in this view yet.
68330 days
1.8K90 days
5.4K1 year
Compare downloads with other packages →
Also on434 r2u42 autocran94 c2d4u

Repository

16Stars
8Forks
2Open issues
0Open PRs
1Releases
52Commits
2Commit identities
garchmcmcbayesianrisk-modelsstudent
License file reads as GPL-2.0 · 52 commits · Last activity 2026-08-21 · 0% stars, 30d
Responsiveness
How these are sampled
PRs merged (all time)
not measured
Median days to close, 50 most recently updated closed issues
0
Median days to close, 50 most recently updated closed PRs
not measured

Stars over time

2025-09-30 · 142026-07-07 · 16
PracticesBeta

4 development-tooling and community-health practices detected across 3 families in the upstream repository

Checks run against github.com/ardiad/bayesgarch on 2026-10-22.

Governance and community (1)
Contributing guide
CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v4 (2026-10-20)

Dependencies

Declared dependencies
3 external dependencies (excludes base and recommended)

Installing bayesGARCH adds 1 package (0 with compiled code, 73 KB of source tarballs). Heaviest: coda 73 KB.

Depends (0)
none
Imports (1)
LinkingTo (0)
none
Suggests (2)
Enhances (0)
none
Reverse dependencies
0direct
0indirect
Suggested by 1
Suggests, most downloaded first

Datasets

People & History

People (1)
Author, Maintainer since 1-00.01 (2008), Copyright holder, Funder
Releases (26)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • R
    R 4.3.0 released · 2023-04-21
  • R
    R 4.2.0 released · 2022-04-22
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • R
    R 3.6.0 released · 2019-04-26
  • R
    R 3.5.0 released · 2018-04-23
  • R
    R 3.4.0 released · 2017-04-21
  • R
    R 3.3.0 released · 2016-05-03
  • R
    R 3.2.0 released · 2015-04-16
  • R
    R 3.1.0 released · 2014-04-10
  • 3.0.3Latest
    record
    2014-01-07 · current release · diff ↗
  • R
    R 3.0.0 released · 2013-04-03
  • R
    R 2.15.0 released · 2012-03-30
Show 33 earlier eventsHide 33 earlier events

Package metadata

First published
2008-06-03
Total releases
26 / 18 yrs
License
GPL (>= 2) OSI
Bundled data
15 KB / 1 file
Download size
54 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("bayesGARCH")

The package provides a citation file that builds its entry when R runs it. Run citation() to see it.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for bayesGARCH version 2.2.0 [Data set]. HJJB, LLC. Data release v2026-10-25. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy