SpikeAndSlabPrior._scale_variance#
- SpikeAndSlabPrior._scale_variance(scales, context)[source]#
Spike or slab variance per the current indicators, loose elsewhere.
The raw-coefficient variance the current state implies: each lag coefficient carries \((s_i / s_j)^2 \tau_1^2\) when its indicator is one and \((s_i / s_j)^2 \tau_0^2\) otherwise, and every deterministic and exogenous row carries \((\text{deterministic\_scale} \cdot s_i)^2\). This is the variance the coefficient block is drawn under on the next sweep.
- Parameters:
- Return type:
- Returns:
A
(width, k)array of positive variances in design-column order.
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 = SpikeAndSlabPrior() >>> state = prior._initial_scales(ctx, np.full((3, 2), 0.05)) >>> state["gamma"][0, 1] = 0.0 >>> prior._scale_variance(state, ctx) array([[1.0e+02, 1.0e+02], [2.5e-01, 2.5e-05], [2.5e-01, 2.5e-01]])