CounterfactualResult#
- class impulso.results.CounterfactualResult(*, idata, var_names)[source]#
Bases:
VARResultBaseHistorical counterfactual paths alongside the actual data.
The posterior-predictive Dataset carries “counterfactual” (chain, draw, time, variable) and “actual” (time, variable) over the same returned window. Counterfactual draws are built from the realised structural shocks — edited, never re-drawn — so their spread reflects parameter and identification uncertainty only.
- idata#
InferenceData-schema container with counterfactual draws + actual path.
- actual()[source]#
The observed path over the returned window.
- Returns:
DataFrame shaped like median().
- Return type:
- difference()[source]#
Posterior median effect of the edits: actual - counterfactual.
The actual path is constant across draws, so actual - median(counterfactual) equals median(actual - counterfactual) exactly.
- Returns:
DataFrame shaped like median().
- Return type:
- median()[source]#
Posterior median counterfactual path.
- Returns:
DataFrame indexed by the returned window’s DatetimeIndex with one column per variable.
- Return type:
- model_config = {'arbitrary_types_allowed': True, 'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].