StudentBVAR.fit#

StudentBVAR.fit(*, df=None, n_draws=2000, n_burn=1000, thin=2, seed=None)[source]#

Estimate by Gibbs on the scale-mixture representation.

Each iteration draws (B, Sigma) from the weighted conjugate posterior, the weights from their Gamma conditionals given the residuals, and – when df is None – the degrees of freedom from their exact conditional on the grid. The retained draws number ceil((n_draws - n_burn) / thin).

Parameters:
  • df (float | None) – Degrees of freedom, above two – or None (the default) to give the tail index a posterior of its own.

  • n_draws (int) – Total sampler iterations.

  • n_burn (int) – Burn-in iterations discarded.

  • thin (int) – Keep every thin-th post-burn draw.

  • seed (int | Generator | None) – Seed or generator, for reproducibility.

Return type:

StudentBVARResult

Returns:

The fitted StudentBVARResult.

Raises:
  • SpecificationError – If the draw bookkeeping is inconsistent, a stated df does not exceed two, or the prior is unusable.

  • NumericalError – If a conditional draw collapses.

Example

The tail index stated, then estimated; and the two refusals:

>>> import numpy as np
>>> y = np.random.default_rng(0).standard_normal((120, 2))
>>> model = StudentBVAR(y, order=1)
>>> fixed = model.fit(df=5.0, n_draws=30, n_burn=10, thin=4, seed=0)
>>> fixed.df, fixed.df_estimated, fixed.n_kept
(5.0, False, 5)
>>> free = model.fit(n_draws=30, n_burn=10, seed=0)
>>> free.df_estimated, free.df_draws.shape
(True, (10,))
>>> model.fit(df=2.0, n_draws=30, n_burn=10)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: df must exceed 2 for the innovations to ...
>>> model.fit(n_draws=10, n_burn=10)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: n_draws (10) must exceed n_burn (10).