ConjugateVAR#
- class impulso.conjugate.ConjugateVAR(*, lags, prior, volatility=None, draws=1000, tune=1000, seed=None)[source]#
Bases:
ImpulsoBaseModelClosed-form conjugate (Normal-Inverse-Wishart) Bayesian VAR estimator.
- Parameters:
- volatility#
Optional deterministic volatility break (
ConjugateVolatility), orNonefor a homoscedastic conjugate VAR. The break must declare at least one hyperparameter to estimate; an adapter with none is rejected at construction because the closed-form fast path would silently ignore it.- Type:
- fit(data)[source]#
Estimate the conjugate VAR and pack the draws into a
FittedVAR.- Parameters:
data (VARData) – Endogenous data to fit.
- Returns:
A
FittedVARwhose posterior holdsB(lag coefficients only),intercept, the base Cholesky factorL, and every estimated hyperparameter (e.g.lambda_,s_march,s_april,s_may,rho), all with a singletonchaindimension. The posterior’s attrs carry in_sample_length (observations after lag trimming) so volatility adapters can anchor forecast paths at the true sample end, and — only when at least one hyperparameter was estimated — metropolis_acceptance_rate, the acceptance rate of the random-walk Metropolis sampler over the retained draws. On the fixed-prior fast path no Metropolis chain runs (draws come straight from the closed-form posterior), so the attr is absent rather than stamped with a meaningless 1.0. FittedVAR.evidence carries the closed-form log marginal likelihood at the selected hyperparameters together with the metadata impulso.compare_evidence needs to form Bayes factors.- Raises:
ValueError – If data carries exogenous regressors — the conjugate engine estimates endogenous dynamics only, and silently dropping the exog block would corrupt every downstream forecast.
- Return type:
- model_config = {'arbitrary_types_allowed': True, 'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].