UCSV.fit#

UCSV.fit(*, n_draws=3000, n_burn=1000, thin=1, prior=None, seed=None)[source]#

Run the Gibbs sampler and return the posterior.

Parameters:
  • n_draws (int) – Total iterations.

  • n_burn (int) – Burn-in discarded.

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

  • prior (_RandomWalkVolatilityPrior | None) – RandomWalkVolatilityPrior instance, read only when gamma is estimated; the defaults when None.

  • seed (int | None) – Seed.

Return type:

_UCSVPosterior

Returns:

The posterior record, with the trend and irregular-volatility paths, the per-draw arrays and the convergence diagnostics.

Raises:

SpecificationError – If the draw bookkeeping is inconsistent.

Example

Estimating the vol-of-vol rather than fixing it:

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = np.cumsum(0.2 * rng.standard_normal(200)) + 0.7 * rng.standard_normal(200)
>>> post = UCSV(y, gamma=None).fit(n_draws=300, n_burn=100, seed=0)
>>> post.gamma_fixed, post.gamma2_trend_draws.shape, post.n_kept
(False, (200,), 200)