Skip to content

FittedVAR

FittedVAR — reduced-form posterior from Bayesian VAR estimation.

FittedVAR

Bases: ImpulsoBaseModel

Immutable container for a fitted (reduced-form) Bayesian VAR.

Attributes:

Name Type Description
idata InferenceData

ArviZ InferenceData with posterior draws.

n_lags int

Lag order used in estimation.

data VARData

Original VARData used for fitting.

var_names list[str]

Names of endogenous variables.

volatility VolatilityProcess

Volatility process used at fit time. Required; populated by VAR.fit from VAR.volatility (default at the spec level is "constant", which resolves to Constant()).

coefficients property

Posterior draws of B coefficient matrices.

has_exog property

Whether the model includes exogenous variables.

intercepts property

Posterior draws of intercept vectors.

forecast(steps, exog_future=None)

Produce h-step-ahead forecasts from the reduced-form posterior.

Parameters:

Name Type Description Default
steps int

Number of forecast steps.

required
exog_future ndarray | None

Future exogenous values, shape (steps, k). Required if model has exog.

None

Returns:

Type Description
ForecastResult

ForecastResult with posterior forecast draws.

set_identification_strategy(scheme)

Apply a structural identification scheme.

Queries the fitted volatility process for the Cholesky factor of Σ and passes it to the scheme. For constant volatility, the factor is the same across all time points; for stochastic volatility (P3), cholesky_at(t=None) returns the most-recent slice and downstream IRF/FEVD/HD methods can re-query at other at values.

Parameters:

Name Type Description Default
scheme IdentificationScheme

An IdentificationScheme protocol instance (e.g. Cholesky, SignRestriction).

required

Returns:

Type Description
IdentifiedVAR

IdentifiedVAR with structural_shock_matrix in the posterior.

sigma()

Posterior draws of the structural-shock covariance Σ.

Dispatches to the configured volatility adapter so the returned shape depends on whether Σ is time-invariant or time-varying:

  • Constant volatility — Σ is shared across time, so the result has shape (chains, draws, n_vars, n_vars).
  • Stochastic volatility — Σ_t evolves, so the result has shape (chains, draws, T, n_vars, n_vars) where T is the in-sample length after lag trimming. Callers needing a single slice should call volatility.cholesky_at(posterior, t) and square the factor themselves.
Note

Breaking change vs. v0.0.4 and earlier: sigma is now a method, not a property. Call sites that used fitted.sigma must be updated to fitted.sigma().

Returns:

Type Description
ndarray

Posterior draws of Σ (or Σ_t for SV) computed from the

ndarray

volatility adapter's Cholesky factor as L @ L.T.