GibbsBVARResult.shrinkage_scales#
- GibbsBVARResult.shrinkage_scales()[source]#
Posterior mean local-global scale of each standardized lag coefficient.
Entry
[lag, i, j]is the averaged prior standard deviation the hierarchy assigned to that coefficient on the standardized (unit-free) scale: near zero means shrunk away, order one means left free. Comparable within a fit, not across priors.- Return type:
- Returns:
A
(p, k, k)stack aligned withcoefficients.- Raises:
SpecificationError – If the prior was not a global-local shrinkage prior.
Example
Under the horseshoe the own lags of a diagonal VAR keep a larger scale than the cross lags:
>>> import numpy as np >>> from cultivars.bayes.priors import HorseshoePrior >>> rng = np.random.default_rng(0) >>> y = np.zeros((200, 3)) >>> for t in range(1, 200): ... y[t] = 0.6 * y[t - 1] + rng.standard_normal(3) >>> res = GibbsBVAR(y, order=1, prior=HorseshoePrior()).fit( ... n_draws=300, n_burn=100, seed=0 ... ) >>> scale = res.shrinkage_scales()[0] >>> scale.shape, bool(np.diag(scale).min() > scale[~np.eye(3, dtype=bool)].max()) ((3, 3), True) >>> static = GibbsBVAR(y, order=1).fit(n_draws=60, n_burn=20, seed=0) >>> static.shrinkage_scales() Traceback (most recent call last): cultivars.exceptions.SpecificationError: shrinkage scales exist only under a ...