BVARSV#

class cultivars.multivariate.large_dim.volatility.BVARSV(endog, *, order, prior=None, trend='c', names=None)[source]#

Bayesian VAR with stochastic volatility, Carriero-Clark-Marcellino.

Constant coefficients under a Minnesota prior – the full Litterman prior, cross-equation weight included, since no conjugacy is needed – with per-equation random-walk log volatilities through the triangular factorization. Order names in the recursive ordering you intend: the factorization makes it a structural declaration.

Parameters:
  • endog (ArrayLike) – The observed panel, shape (nobs, k).

  • order (int) – Autoregressive order.

  • prior (_Prior | None) – Any finite-variance moment prior; dummy-observation content is refused. Defaults to MinnesotaPrior().

  • trend (Literal['n', 'c', 'ct']) – Deterministic terms.

  • names (Sequence[str] | None) – One label per variable, in the intended recursive order.

Example

>>> rng = np.random.default_rng(0)
>>> y = np.zeros((150, 2))
>>> for t in range(1, 150):
...     scale = 0.5 + 1.0 * t / 150
...     y[t] = 0.5 * y[t - 1] + scale * rng.standard_normal(2)
>>> res = BVARSV(y, order=1).fit(n_draws=60, n_burn=20, seed=0)
>>> res.volatility_path("y1").shape
(149, 3)
>>> res.h_draws.shape[1:]
(149, 2)

Attributes#

endog

The validated sample.

is_shrunk

Whether a prior contributes anything to this estimate.

k_endog

Number of endogenous variables.

n_regressors

Regressors per equation.

names

Variable labels.

order

Autoregressive order.

prior

The prior on the coefficients; NoPrior when unrestricted.

trend

Deterministic specification.

Methods#

fit(*[, n_draws, n_burn, thin, k_vol, seed])

Estimate by Gibbs with the KSC volatility block.

lag_order_selection([max_lags])

Score every order from zero to max_lags on one common sample.