IndependentNormalWishartPrior.coefficient_variance#

IndependentNormalWishartPrior.coefficient_variance(context)[source]#

Litterman’s variances, the cross-equation weight kept.

Delegates to MinnesotaPrior.coefficient_variance() through _minnesota(): own lags \((\lambda_1 / l^{\lambda_3})^2\), cross lags the same times \((\lambda_2 s_i / s_j)^2\), the deterministic and exogenous block \((\lambda_1 \lambda_4 s_i)^2\). With \(\lambda_2 \ne 1\) a column is no longer \(s_i^2\) times a constant, which is what the conjugate estimator checks for and this pairing does not need.

Parameters:

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

Return type:

NDArray[double]

Returns:

A (width, k) array of finite positive variances in design-column order.

Raises:

SpecificationError – If a hyperparameter is out of range.

Example

With residual scales one and four, dividing by \(s_i^2\) no longer leaves a column-wise constant, because of the cross-equation weight:

>>> import numpy as np
>>> from cultivars.bayes.priors import PriorContext
>>> ctx = PriorContext(
...     k_endog=2, order=1, scales=np.array([1.0, 4.0]),
...     presample_mean=np.zeros(2),
... )
>>> variance = IndependentNormalWishartPrior().coefficient_variance(ctx)
>>> (variance / ctx.scales**2).round(4)
array([[4.0e+02, 4.0e+02],
       [4.0e-02, 1.0e-02],
       [6.0e-04, 2.5e-03]])