DirichletLaplacePrior#
- class cultivars.bayes.priors.DirichletLaplacePrior(*, concentration=0.5, deterministic_scale=10.0)[source]
Bases:
_AdaptivePriorDirichlet-Laplace shrinkage: a simplex rations the prior’s attention.
Bhattacharya, Pati, Pillai and Dunson’s (2015) global-local prior. Each standardized lag coefficient is Laplace-distributed with its own scale, and the scales are a global magnitude times a point on the simplex,
\[\beta_{ij} \mid \phi_{ij}, \tau \sim \mathrm{Laplace}(0,\, \phi_{ij} \tau), \qquad \phi \sim \mathrm{Dirichlet}(a, \ldots, a), \qquad \tau \sim \mathrm{Gamma}(m a,\, 1/2),\]with \(m\) the number of lag coefficients and \(\beta_{ij}\) the coefficient divided by the Minnesota unit ratio \(s_i / s_j\). The simplex is the substance. The local scales must sum to \(\tau\), so a small concentration \(a\) makes the Dirichlet spiky and the prior can only pay attention to a few coefficients at once: a budget constraint the horseshoe, whose local scales are independent, does not impose. Among the continuous shrinkage priors it carries the strongest theoretical warrant, posterior contraction at the minimax rate for sparse means when the concentration is set near \(1/m\); the paper’s working default \(a = 1/2\) trades some of that sparsity for a gentler prior on dense signals.
Sampling writes the Laplace as a scale mixture of normals, \(\beta_{ij} \mid \psi_{ij} \sim \mathcal{N}(0, \psi_{ij} \phi_{ij}^2 \tau^2)\) with \(\psi_{ij} \sim \mathrm{Exp}(1/2)\), after which every conditional is exact: inverse-Gaussian for the mixing scales, generalized-inverse-Gaussian for the global magnitude and, after normalization, for the simplex. The deterministic and exogenous columns are not shrunk; they sit at a fixed loose variance.
- Variables:
concentration – The Dirichlet concentration \(a\);
0.5is the paper’s default, and values near1 / (k**2 * order)are its theory’s.deterministic_scale – Looseness of the unshrunk deterministic and exogenous rows, in units of each equation’s residual scale.
- Raises:
SpecificationError – If
concentrationordeterministic_scaleis not positive, at the first moment call, which is the model’s fit.
Note
The prior mean is zero everywhere, without a persistence hyperparameter: centring a sparsity prior away from zero would change what shrinking a coefficient means. Difference the data, or use the Minnesota family, for random-walk centring. Adaptive priors do not compose, and the Chib marginal likelihood is not offered under one; compare by predictive score. The local-global scale this prior reports is \(\sqrt{\psi_{ij}}\, \phi_{ij} \tau\), the prior standard deviation of the standardized coefficient, on the same footing as the horseshoe’s \(\tau \lambda_{ij}\).
Warning
Only
GibbsBVARsamples the hierarchy. The static moments interface reports the variance at the initial scales, \(1/m^2\) on the standardized lag block, which is what admissibility checks need and not the Dirichlet-Laplace; a model that reads only the static moments is fitting a fixed Gaussian prior under this class’s label.See also
shrinkage_scales()– the posterior mean local-global scale per lag coefficient, this prior’s diagnostic.HorseshoePrior– independent half-Cauchy local scales, no attention budget.NormalGammaPrior– Gamma local variances with a tunable shape, the other GIG-conditional hierarchy.SpikeAndSlabPrior– selection rather than shrinkage.
References
Bhattacharya, A., Pati, D., Pillai, N. S., & Dunson, D. B. (2015). Dirichlet-Laplace priors for optimal shrinkage. Journal of the American Statistical Association, 110(512), 1479-1490.
Polson, N. G., & Scott, J. G. (2010). Shrink globally, act locally: Sparse Bayesian regularization and prediction. In Bayesian Statistics 9 (pp. 501-538). Oxford University Press.
Example
Three series of which only the first has an own lag. The local-global scale is above one on the signal and a fraction of that on every noise coefficient:
>>> import numpy as np >>> from cultivars.multivariate.large_dim.gibbs import GibbsBVAR >>> rng = np.random.default_rng(0) >>> y = np.zeros((200, 3)) >>> for t in range(1, 200): ... y[t] = np.array([0.8, 0.0, 0.0]) * y[t - 1] + rng.standard_normal(3) >>> res = GibbsBVAR(y, order=1, prior=DirichletLaplacePrior()).fit( ... n_draws=1500, n_burn=500, seed=0 ... ) >>> res.prior_label 'dl(a=0.5)' >>> scales = res.shrinkage_scales()[0] >>> bool(scales[0, 0] > 1.0), bool(np.delete(scales, 0).max() < 0.6) (True, True) >>> np.abs(res.coefficients[0]).round(1) array([[0.7, 0. , 0. ], [0.1, 0. , 0.1], [0. , 0. , 0. ]])
Private methods#
|
Reject hyperparameters that do not describe a prior. |
|
The exact conditionals of Bhattacharya et al. (2015). |
|
Uniform simplex, unit local scales, unit global magnitude. |
|
Short description for summary tables and comparison rows. |
|
|
|
The local-global scale per lag coefficient. |
What the averaged diagnostic is. |