Identification Schemes¶
Identification schemes for structural VAR analysis.
Cholesky
¶
Bases: ImpulsoModel
Cholesky identification scheme.
Uses the lower-triangular Cholesky decomposition of the residual covariance matrix to identify structural shocks. Variable ordering determines the causal ordering.
Attributes:
| Name | Type | Description |
|---|---|---|
ordering |
list[str]
|
Ordered list of variable names (most exogenous first). |
identify(L, var_names, posterior=None)
¶
Apply Cholesky identification.
For default variable ordering, identify is a no-op and returns
L unchanged. When self.ordering differs from var_names,
the underlying covariance is permuted and re-decomposed so the
Cholesky factor reflects the requested causal ordering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
L
|
ndarray
|
Lower-triangular Cholesky factor, shape (chains, draws, n_vars, n_vars). |
required |
var_names
|
list[str]
|
Variable names in the data's natural order. |
required |
posterior
|
Dataset | None
|
Unused. Accepted for Protocol uniformity. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Structural shock matrix, shape (chains, draws, n_vars, n_vars). |
shock_coords(n_vars)
¶
Cholesky shock labels are simply the causal ordering.
SignRestriction
¶
Bases: ImpulsoModel
Sign restriction identification scheme.
Uses random rotation matrices to find structural impact matrices satisfying sign restrictions on impulse responses.
Attributes:
| Name | Type | Description |
|---|---|---|
restrictions |
dict[str, dict[str, str]]
|
Dict mapping variable -> {shock_name: "+" or "-"}. |
n_rotations |
int
|
Number of candidate rotations per draw. |
random_seed |
int | None
|
Seed for reproducibility. |
identify(L, var_names, posterior=None)
¶
Apply sign-restriction identification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
L
|
ndarray
|
Lower-triangular Cholesky factor, shape (chains, draws, n_vars, n_vars). |
required |
var_names
|
list[str]
|
Variable names in the data's natural order. |
required |
posterior
|
Dataset | None
|
Required when |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Structural shock matrix, shape (chains, draws, n_vars, n_vars). |
ndarray
|
Per-draw fallback to the supplied |
ndarray
|
rotation satisfies the restrictions. Acceptance rate available |
ndarray
|
via the |
ndarray
|
wrapping IdentifiedVAR's posterior (set by the pipeline). |
shock_coords(n_vars)
¶
Sign-restriction shock labels: named shocks first, then padding.