DirichletLaplacePrior._tracked#

DirichletLaplacePrior._tracked(scales, context)[source]#

The local-global scale per lag coefficient.

\(\sqrt{\psi_{ij}}\, \phi_{ij} \tau\), the prior standard deviation of the standardized coefficient under the current state: near zero means the coefficient is being shrunk away, order one or larger means it is left free. The sampler averages this over kept sweeps into the result’s shrinkage; deterministic and exogenous rows are reported as zero because they are not shrunk.

Parameters:
  • scales (dict[str, NDArray[double]]) – The current latent state.

  • context (_PriorContext) – The sample description; width, k_endog, order, and lag_offset are read.

Return type:

NDArray[double]

Returns:

A (width, k) array, zero off the lag block.

Example

>>> import numpy as np
>>> from cultivars.bayes.priors import PriorContext
>>> ctx = PriorContext(
...     k_endog=2, order=1, scales=np.ones(2), presample_mean=np.zeros(2)
... )
>>> prior = DirichletLaplacePrior()
>>> state = prior._initial_scales(ctx, prior._unit_ratio(ctx))
>>> state["tau"][0] = 2.0
>>> prior._tracked(state, ctx)
array([[0. , 0. ],
       [0.5, 0.5],
       [0.5, 0.5]])