Priors
polars_ts.bayesian_var.priors
Prior specifications for Bayesian VAR.
Provides the Minnesota (Litterman) and Normal-Wishart prior dataclasses, along with helper functions for building prior precision matrices.
MinnesotaPrior
dataclass
Minnesota (Litterman) prior for BVAR.
Shrinks VAR coefficients toward a random walk: own first lag receives prior mean 1, all others 0. Tightness parameters control how strongly the prior pulls toward this structure.
Parameters
lambda1
Overall tightness. Smaller values shrink more aggressively.
lambda2
Cross-variable tightness (relative to own-lag). Typically < 1
so cross-variable lags are shrunk harder.
lambda3
Lag decay. Higher values shrink distant lags more aggressively.
Prior variance for lag l is scaled by l^{-lambda3}.
sigma_scale
Per-variable residual variance estimates. If None, estimated
from univariate AR(p) regressions.
NormalWishartPrior
dataclass
Normal-Wishart conjugate prior for BVAR.
Places a matrix-normal prior on the coefficient matrix B
and a Wishart prior on the precision matrix Sigma^{-1}.
Parameters
B0
Prior mean for the coefficient matrix, shape (k, k*p+1).
If None, defaults to random walk (identity on first own-lag).
V0
Prior precision (inverse covariance) for vec(B),
shape (k*p+1, k*p+1). If None, uses Minnesota-style
diagonal with the given tightness.
S0
Prior scale matrix for Wishart, shape (k, k).
If None, uses identity scaled by data variance.
nu0
Degrees of freedom for Wishart. Must be >= k.
If None, defaults to k + 2.
tightness
Diagonal tightness for automatic V0 construction.
_estimate_sigma_from_ar(data, p)
Estimate per-variable residual variance from univariate AR(p).
_minnesota_prior_precision(k, p, prior, sigma_scale)
Build Minnesota prior mean B0 and precision V0_inv.
Returns
B0
Prior mean, shape (k, k*p+1).
V0_inv
Prior precision diagonal, shape (k*p+1,).