NIWPrior#

class impulso.priors.NIWPrior(*, tightness=0.2, select=False, decay=2.0, cross_shrinkage=1.0, sum_of_coefficients=None, single_unit_root=None, lambda_mode=0.2, lambda_sd=0.4)[source]#

Bases: ImpulsoModel

Natural-conjugate Normal-Inverse-Wishart Minnesota prior (Giannone-Lenza-Primiceri, 2015).

Distinct from MinnesotaPrior: that prior uses an independent-Normal coefficient prior with a separate covariance and is sampled with MCMC, whereas this prior is conjugate, so the posterior and marginal likelihood are closed-form. The conjugate (Kronecker) structure is what buys the closed form; its cost is that per-equation own/cross shrinkage asymmetry is not identified (use MinnesotaPrior for that).

Parameters:
tightness#

Overall Minnesota shrinkage lambda (prior standard deviation). Must be > 0. When select is set this is only the starting value; the tightness is estimated by marginal likelihood.

Type:

float

select#

Estimate the tightness from the data (empirical / hierarchical Bayes) rather than fixing it.

Type:

bool

decay#

Lag-decay exponent on the prior variance (GLP alpha); 2 gives a harmonic decay of the prior standard deviation.

Type:

float

cross_shrinkage#

Shared lag-variance scale; 1.0 reproduces GLP (2015). In the conjugate prior this is not separately identified from tightness.

Type:

float

sum_of_coefficients#

Sum-of-coefficients prior scale, or None to disable.

Type:

float | None

single_unit_root#

Single-unit-root (dummy-initial-observation) prior scale, or None to disable.

Type:

float | None

lambda_mode#

Mode of the Gamma hyperprior on the tightness (used when select).

Type:

float

lambda_sd#

Standard deviation of the Gamma hyperprior on the tightness.

Type:

float

Expand for references to impulso.priors.NIWPrior

The conjugate VAR: fast Bayesian estimation / When to reach for ConjugateVAR instead of the NUTS VAR / Scope

Estimating a VAR after March 2020 / What this reproduction does and does not match

build_dummies(y, n_lags, sigma=None, *, tightness=None)[source]#

Build the Minnesota dummy observations this prior implies.

Parameters:
  • y (ndarray) – Raw data of shape (T_full, n_vars).

  • n_lags (int) – Number of lags.

  • sigma (ndarray | None) – Per-variable scale (AR(1) residual sd). Computed from y via impulso._conjugate.ar1_residual_sd() when None.

  • tightness (float | None) – Override for lambda (used when sweeping the marginal likelihood during selection); defaults to tightness.

Returns:

Tuple (Yd, Xd) as returned by impulso._conjugate.minnesota_dummies().

Return type:

tuple[ndarray, ndarray]

model_config = {'frozen': True}#

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