ConjugateVolatility#

class impulso.conjugate_volatility.ConjugateVolatility(*, is_time_varying=True)[source]#

Bases: ImpulsoModel

Query-surface adapter for a deterministically time-varying conjugate VAR.

Reports L_t = s_t * L_base, where L_base = posterior[“L”] is the base Cholesky factor drawn by the conjugate engine and s_t is a deterministic volatility multiplier whose schedule is defined by the subclass. The multiplier’s free hyperparameters are estimated by the marginal-likelihood sampler through hyperparameter_priors and log_scales.

Subclasses implement the schedule via log_scales, hyperparameter_priors, _posterior_scales, and _forecast_indices; the query surface itself (cholesky_at / cholesky_path / forecast_cholesky_path) is shared here.

Parameters:

is_time_varying (bool)

is_time_varying#

Always TrueSigma_t varies across t.

Type:

bool

cholesky_at(posterior, t)[source]#

Cholesky factor L_t = s_t * L_base at time t for every draw.

Parameters:
  • posterior (xr.Dataset) – Dataset with the base factor L (chains, draws, n, n) and the subclass’s scale-hyperparameter draws.

  • t (int | None) – In-sample time index. None returns the baseline factor (s_t = 1), i.e. the pandemic-free covariance — a deterministic break stores no explicit “most recent” time to resolve.

Returns:

(chains, draws, n_vars, n_vars).

Return type:

np.ndarray

cholesky_path(posterior, T)[source]#

Cholesky factor path L_t for t in 0..T-1.

Returns (chains, draws, T, n_vars, n_vars).

Parameters:
  • posterior (xr.Dataset)

  • T (int)

Return type:

np.ndarray

forecast_cholesky_path(posterior, steps, rng)[source]#

Cholesky factor path for steps ahead, continuing the deterministic decay.

rng is accepted for parity with stochastic adapters and ignored — the post-sample scale path is deterministic given the posterior draws.

The forecast anchor is the posterior’s in_sample_length attr (stamped by ConjugateVAR.fit): step k continues the scale schedule at absolute index in_sample_length + k, so the forecast origin joins the last in-sample scale with no discontinuity. Posteriors without the attr fall back to the subclass’s legacy _forecast_indices assumption with a warning.

Returns (chains, draws, steps, n_vars, n_vars).

Parameters:
  • posterior (xr.Dataset)

  • steps (int)

  • rng (np.random.Generator)

Return type:

np.ndarray

hyperparameter_priors()[source]#

1-D priors on the free volatility hyperparameters, keyed by name.

Return type:

dict[str, Prior1D]

log_scales(theta, T)[source]#

In-sample log-scale path log s_t of shape (T,) for hyperparameters theta.

Fed to impulso._conjugate.log_marginal_likelihood(log_scales=…).

Parameters:
Return type:

ndarray

model_config = {'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].