Prior#

class impulso.protocols.Prior(*args, **kwargs)[source]#

Bases: Protocol

Contract for prior specifications.

Expand for references to impulso.protocols.Prior

Writing a Custom Prior / The Prior protocol

build_priors(n_vars, n_lags, *, sigma)[source]#

Build prior mean and standard deviation arrays for VAR coefficients.

Parameters:
  • n_vars (int) – Number of endogenous variables.

  • n_lags (int) – Number of lags.

  • sigma (ndarray) – Per-endogenous-variable scale, shape (n_vars,) — the AR(1) residual standard deviation of each series (impulso._conjugate.ar1_residual_sd), the same scale the conjugate NIWPrior already keys its lag-coefficient prior off of via minnesota_dummies. Required and keyword-only: a prior that has no use for the data’s scale (e.g. a flat prior) still takes the argument, it just ignores it. VAR.fit computes this once from the fitted data and passes it here; a future seam may let callers supply their own scales instead (docs/adr/0015).

Returns:

Dictionary with keys “B_mu” and “B_sigma” as numpy arrays, each of shape (n_vars, n_vars * n_lags).

Return type:

dict[str, ndarray]