gEconpy.model.model.Model.symbolic_linearization#
- Model.symbolic_linearization(order=1, log_linearize=True, not_loglin_variables=None, steady_state=None, loglin_negative_ss=False, verbose=True)#
Return the symbolic pytensor graphs for the linearized Jacobian matrices.
Builds (and caches) the four Jacobian matrices
A, B, C, Das pytensor graph nodes representing the first-order approximation of the model around its steady state:\[A \hat{y}_{t-1} + B \hat{y}_t + C \hat{y}_{t+1} + D \varepsilon_t = 0\]Unlike
linearize_model(), this method does not compile or numerically evaluate the graphs. The returned nodes can be inspected, manipulated, or compiled by the caller.- Parameters:
- order
int, default 1 Order of the Taylor expansion. Only
order=1is currently supported.- log_linearizebool, default
True If True, all variables are log-linearized. If False, all variables are left in levels.
- not_loglin_variables
listofstr, optional Variable names to exclude from log-linearization. Ignored if
log_linearizeis False.- steady_state
dict, optional Steady-state values used to determine which variables have non-positive steady states (and therefore cannot be log-linearized). If not provided, the steady state is solved internally.
- loglin_negative_ssbool, default
False If True, variables with negative steady-state values are still log-linearized.
- verbosebool, default
True Log warnings about excluded variables.
- order
- Returns:
- jacobians
listofTensorVariable Four pytensor matrix graph nodes
[A, B, C, D]. Rows are inself.eq_orderand the variable axis (cols of A/B/C) is inself.var_order; D’s columns are shocks (no permutation).- ss_input_nodes
listofTensorVariable Steady-state variable input nodes consumed by the Jacobian graphs.
- param_input_nodes
listofTensorVariable Parameter input nodes consumed by the Jacobian graphs (discovered via
explicit_graph_inputs).- eq_order
ndarrayofint Equation row permutation actually applied (a copy of
self.eq_order).- var_order
ndarrayofint Variable column permutation actually applied (a copy of
self.var_order).
- jacobians
See also
linearize_modelCompile and numerically evaluate the linearized system.
Examples
model = model_from_gcn("rbc.gcn") jacobians, ss_nodes, param_nodes, eq_order, var_order = model.symbolic_linearization() A, B, C, D = jacobians # Inspect the pytensor graph import pytensor pytensor.dprint(A)