SignRestriction#
- class impulso.identification.SignRestriction(*, restrictions, n_rotations=1000, restriction_horizon=0, random_seed=None)[source]#
Bases:
ImpulsoModelSign restriction identification scheme.
Uses random rotation matrices to find structural impact matrices satisfying sign restrictions on impulse responses.
- Parameters:
- identify(L, var_names, posterior=None, data=None, n_lags=None)[source]#
Apply sign-restriction identification.
- Parameters:
L (ndarray) – Lower-triangular Cholesky factor, shape (chains, draws, n_vars, n_vars).
var_names (list[str]) – Variable names in the data’s natural order.
posterior (xr.Dataset | None) – Required when self.restriction_horizon > 0 because the multi-horizon check needs the VAR coefficients B from the posterior. Ignored for impact-only restrictions (restriction_horizon == 0).
data (VARData | None) – Unused. Accepted for Protocol uniformity.
n_lags (int | None) – Unused. Accepted for Protocol uniformity.
- Returns:
Structural shock matrix, shape (chains, draws, n_vars, n_vars). Per-draw fallback to the supplied L for draws where no rotation satisfies the restrictions. Acceptance rate available via the sign_restriction_acceptance_rate attribute on the wrapping IdentifiedVAR’s posterior (set by the pipeline).
- Return type:
- model_config = {'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None