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:
ImpulsoModelNatural-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 (useMinnesotaPriorfor that).- Parameters:
- tightness#
Overall Minnesota shrinkage
lambda(prior standard deviation). Must be > 0. Whenselectis set this is only the starting value; the tightness is estimated by marginal likelihood.- Type:
- select#
Estimate the tightness from the data (empirical / hierarchical Bayes) rather than fixing it.
- Type:
- decay#
Lag-decay exponent on the prior variance (GLP
alpha);2gives a harmonic decay of the prior standard deviation.- Type:
- cross_shrinkage#
Shared lag-variance scale;
1.0reproduces GLP (2015). In the conjugate prior this is not separately identified fromtightness.- Type:
- single_unit_root#
Single-unit-root (dummy-initial-observation) prior scale, or
Noneto disable.- Type:
float | None
- 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
yviaimpulso._conjugate.ar1_residual_sd()whenNone.tightness (float | None) – Override for
lambda(used when sweeping the marginal likelihood during selection); defaults totightness.
- Returns:
Tuple
(Yd, Xd)as returned byimpulso._conjugate.minnesota_dummies().- Return type:
- model_config = {'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].