IdentifiedVAR#
- class impulso.identified.IdentifiedVAR(*, idata, n_lags, data, var_names, volatility, scheme)[source]#
Bases:
ImpulsoBaseModelImmutable structural VAR with identified shocks.
- Parameters:
idata (InferenceData)
n_lags (int)
data (VARData)
volatility (VolatilityProcess)
scheme (IdentificationScheme)
- idata#
InferenceData with reduced-form posterior (B, intercept, L, …).
- Type:
arviz.data.inference_data.InferenceData
- data#
Original VARData.
- Type:
- volatility#
Volatility process carried through from the fitted VAR. Required for at= queries on impulse_response / fevd / historical_decomposition (P3), which re-call volatility.cholesky_at(at) for the requested time slice.
- scheme#
Identification scheme used to produce the structural shock matrix. Required for at= queries so the scheme can be re-applied to a different Cholesky factor on demand.
- fevd(horizon=20, at=None)[source]#
Compute forecast error variance decomposition.
Under partial identification (any shock column labelled
unidentified_*), the shares of the unidentified columns are masked to NaN — see_fevd_guard().- Parameters:
horizon (int) – Number of periods.
at (int | Literal['last', 'all'] | None) – Time index for the structural shock matrix (see
shock_matrix()for accepted forms).
- Returns:
FEVDResult with FEVD posterior draws.
- Return type:
- historical_decomposition(start=None, end=None, cumulative=False, at=None)[source]#
Compute historical decomposition of observed series.
Historical decomposition is intrinsically time-indexed: it attributes each in-sample observation to past structural shocks. The
at=parameter controls which Cholesky factor identifies those shocks.Under partial identification (shock columns labelled
unidentified_*), the individual contributions of the unidentified shocks are rotation-arbitrary, but their sum is well-defined (it is the residual variation the identified shocks do not explain). Those columns are therefore collapsed into a singleunidentified_remaindercolumn. The decomposition remains exactly additive, and the identified shocks’ contributions are invariant to both the orthogonal completion and any unit-effect column rescaling.- Parameters:
start (Timestamp | None) – Optional start date to restrict decomposition.
end (Timestamp | None) – Optional end date to restrict decomposition.
cumulative (bool) – If True, return cumulative shock contributions.
at (int | Literal['last', 'all'] | None) – Time index for the structural shock matrix.
Noneor"all"→ per-t decomposition (correct for SV, identical to single-L under constant volatility).intor"last"→ single-L hypothetical (warns under SV).
- Returns:
HistoricalDecompositionResult.
- Return type:
- impulse_response(horizon=20, at=None)[source]#
Compute structural impulse response functions.
- Parameters:
horizon (int) – Number of periods.
at (int | Literal['last', 'all'] | None) – Time index for the structural shock matrix (see
shock_matrix()for accepted forms).
- Returns:
IRFResult with IRF posterior draws.
- Return type:
- model_config = {'arbitrary_types_allowed': True, 'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- shock_matrix(at=None)[source]#
Query the structural shock matrix at a given time index.
This is the single pathway from the volatility process and identification scheme to a labelled structural shock matrix. IRF, FEVD, and historical decomposition all compute through it. Results are memoised per at value on this instance so that all quantities from one
IdentifiedVARshare the same structural draws (deterministic per object, even underSignRestriction).- Parameters:
at (int | Literal['last', 'all'] | None) – Time index.
Noneor"last"→ most recent slice. An integert→ that specific time index."all"→ full time path (adds atimedim).- Returns:
DataArray with dims
(chain, draw[, time], response, shock).- Raises:
ValueError – If
at="all"under constant volatility.- Return type:
DataArray