Cholesky#
- class impulso.identification.Cholesky(*, ordering)[source]#
Bases:
ImpulsoModelCholesky identification scheme.
Uses the lower-triangular Cholesky decomposition of the residual covariance matrix to identify structural shocks. Variable ordering determines the causal ordering.
- identify(L, var_names, posterior=None, data=None, n_lags=None)[source]#
Apply Cholesky identification.
When self.ordering matches var_names this is a no-op and L is returned unchanged. Otherwise the factor is re-derived so that it is lower-triangular in the requested causal ordering, then written back into the data’s row order.
Concretely, with Pi the permutation sending data order to self.ordering, the ordered factor is the LQ factor of Pi @ L: qr((Pi @ L).T) = Q @ R gives G = R.T lower-triangular with G @ G.T = Pi @ Sigma @ Pi.T. Columns are sign-fixed so G has a positive diagonal, matching the textbook cholesky(Pi Sigma Pi.T). Sigma is never formed, so the conditioning of the decomposition is not squared.
- Parameters:
L (ndarray) – Lower-triangular Cholesky factor, shape (…, n_vars, n_vars).
var_names (list[str]) – Variable names in the data’s natural order.
posterior (xr.Dataset | None) – Unused. Accepted for Protocol uniformity.
data (VARData | None) – Unused. Accepted for Protocol uniformity.
n_lags (int | None) – Unused. Accepted for Protocol uniformity.
- Returns:
Structural shock matrix, same shape as L. Rows follow var_names (the data’s order, matching the response coordinate downstream); columns follow shock_coords, i.e. self.ordering. Triangularity therefore holds in the ordering row coordinates: permuting the rows by self.ordering recovers an exactly lower-triangular factor with a positive diagonal.
- Return type:
- model_config = {'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].