HorseshoePrior._initial_scales#

HorseshoePrior._initial_scales(context, reference)[source]#

Unit local scales, unit global scale.

Starting every \(\lambda_{ij}^2\) and \(\tau^2\) at one puts the first sweep’s coefficient draw under a unit-variance Gaussian on the standardized scale, a neutral start the burn-in leaves behind quickly. The auxiliaries \(\nu_{ij}\) and \(\xi\) start at one as well.

Parameters:
  • context (_PriorContext) – The sample description; k_endog and order are read.

  • reference (NDArray[double]) – Data-driven reference scales, ignored: the horseshoe does not anchor on least-squares standard errors.

Return type:

dict[str, NDArray[double]]

Returns:

{"lam2", "nu"} of shape (k * p, k) and {"tau2", "xi"} of shape (1,), all ones.

Raises:

SpecificationError – If deterministic_scale is not positive.

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 = HorseshoePrior()
>>> state = prior._initial_scales(ctx, prior._unit_ratio(ctx))
>>> {name: value.shape for name, value in state.items()}
{'lam2': (2, 2), 'nu': (2, 2), 'tau2': (1,), 'xi': (1,)}