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, D as 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:
orderint, default 1

Order of the Taylor expansion. Only order=1 is currently supported.

log_linearizebool, default True

If True, all variables are log-linearized. If False, all variables are left in levels.

not_loglin_variableslist of str, optional

Variable names to exclude from log-linearization. Ignored if log_linearize is False.

steady_statedict, 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.

Returns:
jacobianslist of TensorVariable

Four pytensor matrix graph nodes [A, B, C, D]. Rows are in self.eq_order and the variable axis (cols of A/B/C) is in self.var_order; D’s columns are shocks (no permutation).

ss_input_nodeslist of TensorVariable

Steady-state variable input nodes consumed by the Jacobian graphs.

param_input_nodeslist of TensorVariable

Parameter input nodes consumed by the Jacobian graphs (discovered via explicit_graph_inputs).

eq_orderndarray of int

Equation row permutation actually applied (a copy of self.eq_order).

var_orderndarray of int

Variable column permutation actually applied (a copy of self.var_order).

See also

linearize_model

Compile 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)