srvar.ssvs

srvar.ssvs.sample_gamma_rows(*, beta, sigma, gamma, spike_var, slab_var, inclusion_prob, fixed_mask=None, rng)[source]

Sample SSVS inclusion indicators for coefficient rows.

This updates gamma given the current coefficient draw beta and covariance sigma under a spike-and-slab prior.

Parameters:
  • beta (ndarray) – VAR coefficient matrix of shape (K, N).

  • sigma (ndarray) – Innovation covariance matrix of shape (N, N).

  • gamma (ndarray) – Current inclusion indicators of shape (K,).

  • spike_var (float) – Spike-and-slab prior variances.

  • slab_var (float) – Spike-and-slab prior variances.

  • inclusion_prob (float) – Prior inclusion probability.

  • fixed_mask (ndarray | None) – Optional boolean mask indicating predictors which are forced to stay included.

  • rng (Generator) – NumPy RNG.

Returns:

Updated boolean indicators of shape (K,).

Return type:

np.ndarray

srvar.ssvs.v0_diag_from_gamma(*, gamma, spike_var, slab_var, intercept_slab_var=None)[source]

Compute the diagonal of V0 implied by spike-and-slab indicators.

Parameters:
  • gamma (ndarray) – Boolean inclusion indicators of shape (K,).

  • spike_var (float) – Variance for excluded predictors.

  • slab_var (float) – Variance for included predictors.

  • intercept_slab_var (float | None) – Optional override for the intercept variance (index 0).

Returns:

Vector of length K representing the diagonal of V0.

Return type:

np.ndarray