gEconpy.model.model.Model#
- class gEconpy.model.model.Model(variables, shocks, equations, steady_state_relationships, steady_state_equations, ss_solution_dict, param_dict, hyper_param_dict, deterministic_dict, calib_dict, priors, is_linear=False, mode=None, error_func='squared')#
A Dynamic Stochastic General Equilibrium (DSGE) Model.
Stores model primitives (variables, parameters, shocks, equations) and compiles steady-state and linearization functions lazily on first use. Construction accepts raw sympy objects; all graph building and pytensor compilation is deferred to the point of use so that only the graphs actually needed are ever built.
Methods
Model.__init__(variables, shocks, equations, ...)Initialize a DSGE model from sympy primitives.
Model.equation_tensors([filter_known])Pytensor graphs for the model's steady-state equations.
Model.evaluate_residual(ss_dict, param_dict)Evaluate the steady-state residual at given variable and parameter values.
Model.get(name)Get a model variable or parameter by name.
Model.linearize_model([order, ...])Linearize the model around the deterministic steady state.
Model.param_tensors([include_free, ...])Pytensor scalar variables for the model's parameters.
Model.parameters(**updates)Compute the full set of free parameters for the model, including deterministic parameters.
Model.solve_model([solver, log_linearize, ...])Solve for the linear approximation to the policy function via perturbation.
Model.ss_tensors([filter_known])Pytensor scalar variables for the model's steady-state symbols.
Model.steady_state([how, use_jac, use_hess, ...])Solve for the deterministic steady state of the DSGE model.
Model.symbolic_linearization([order, ...])Return the symbolic pytensor graphs for the linearized Jacobian matrices.
Attributes
backward_variablesVariables that appear at t-1 in at least one equation (state variables).
calibrated_paramsList of calibrated parameters in the model, stored as
sympy.Symbolobjects.deterministic_paramsList of deterministic parameters in the model, stored as
sympy.Symbolobjects.dr_orderDecision-rule order classifying variables and equations into block-triangular form.
eq_orderRow permutation reordering equations as
[static | lag_only | lead_only | both].equationsList of equations in the model, stored as Sympy expressions.
f_paramsCompiled function mapping free parameter values to the full parameter dictionary.
f_ssCompiled function mapping parameters to known steady-state values, or None if no analytical solutions.
forward_variablesForward-looking (jump) variables.
hyper_paramsList of hyperparameters in the model, stored as
sympy.Symbolobjects.inv_eq_orderInverse of
eq_order.inv_var_orderInverse of
var_order.lead_var_idxColumn indices of forward-looking variables in the Jacobian matrices.
n_backwardNumber of backward-looking (state) variables.
n_forwardNumber of forward-looking (jump) variables.
n_symbolic_forwardn_variablesNumber of endogenous variables in the model.
param_priorsDictionary of prior distributions for the model parameters.
paramsList of parameters in the model, stored as
sympy.Symbolobjects.shock_priorsDictionary of prior distributions for the model shocks.
shocksList of shocks in the model, stored as Sympy symbols.
steady_state_relationshipsList of model equations, evaluated at the deterministic steady state.
symbolic_forward_variablesVariables appearing at t+1 in any equation (purely syntactic).
sympy_to_pytensor_cacheCache mapping sympy symbol identifiers to pytensor graph nodes.
var_orderColumn permutation reordering variables as
[static | pred_only | mixed | forward_only].variablesList of variables in the model, stored as Sympy symbols.