HistoricalDecompositionResult#

class impulso.results.HistoricalDecompositionResult(*, idata, var_names)[source]#

Bases: VARResultBase

Result from the propagated historical decomposition.

The posterior-predictive Dataset carries two variables: “hd” — the propagated contribution of each structural shock — and “baseline” — the deterministic path implied by the initial conditions, intercept, and any exogenous regressors with all shocks set to zero. Baseline plus the contributions summed over shocks reproduces the observed series exactly for every posterior draw.

Parameters:
  • idata (InferenceData)

  • var_names (list[str])

idata#

InferenceData-schema container with decomposition draws.

var_names#

Names of variables.

Type:

list[str]

baseline()[source]#

Posterior median of the deterministic baseline path.

Returns:

DataFrame indexed by the same DatetimeIndex as median(), with one column per variable.

Raises:

ValueError – If the result carries no “baseline” variable (e.g. a hand-built result predating the propagated decomposition).

Return type:

DataFrame

deviation()[source]#

Posterior median of the total deviation from the deterministic baseline.

Median of the per-draw sum of contributions over shocks, so it matches data - baseline() exactly; because median-of-sum differs from sum-of-medians, it need not equal median() summed over the shock column level.

Returns:

DataFrame indexed by the same DatetimeIndex as median(), with one column per variable.

Return type:

DataFrame

hdi(prob=0.89)[source]#

HDI for historical decomposition.

Returns:

HDIResult whose lower / upper DataFrames mirror the shape and labels of median().

Parameters:

prob (float)

Return type:

HDIResult

median()[source]#

Posterior median historical decomposition.

Returns:

DataFrame indexed by a DatetimeIndex over the in-sample period (after lag-trimming and any start / end filter applied at decomposition time), with a MultiIndex([‘response’, ‘shock’]) on columns.

Return type:

DataFrame

model_config = {'arbitrary_types_allowed': True, 'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

plot()[source]#

Plot historical decomposition.

Return type:

Figure

property shock_names: list[str]#

Names of the shock contributions, in the order of the shock coordinate.

Partially-identified decompositions include the unidentified_remainder column.

to_dataframe()[source]#

Convert historical decomposition to DataFrame (passthrough to median()).

Return type:

DataFrame