Skip to content

DSGESolver

class DSGESolver(model_config: ModelConfig, t: sp.Symbol = sp.Symbol('t', integer=True))

Class responsible for model compilation and solution.

Attributes:

Name Type Description
model_config ModelConfig Configuration object to be compiled/solved.
t sp.Symbol Time symbol used in model components.

Methods:

DSGESolver.compile(
    variable_order: list[sp.Function],
    n_state: int = None,
    n_exog: int = None,
    params_order: list[str] = None
    ) -> CompiledModel
Variable Ordering Convention

The model expects the first n_exog variables to be the exogenous components. Before solving the model either;

  • Ensure the variable ordering in the config file follows this convention.
  • Supply an order specification at compile time.
Planned Changes

Current input constraints will be eliminated as SymbolicDSGE moves towards the beta releases. n_exog and n_state will be inferred through flags in the config; and variable ordering will be managed internally.

Produces a CompiledModel object respecting the given orders. n_exog and n_state must be supplied.

Inputs:

Name Description
variable_order Custom ordering of variables if desired.
n_state Number of state variables.
n_exog Number of exogenous variables.
params_order Custom ordering of model parameters if desired.

 

Returns:

Type Description
CompiledModel Numerically compiled model components returned as an object.
SolvedModel.solve(
    compiled: CompiledModel,
    parameters: dict[str, float] = None,
    steady_state: ndarray[float] | dict[str, float] = None,
    log_linear: bool = False
    ) -> SolvedModel

Solves the given compiled model and returns a SolvedModel object.

Inputs:

Name Description
compiled The CompiledModel to solve.
parameters parameter values as dict to override the calibration config.
steady_state model variables' steady state. Defaults to zeroes. (often used in gap models)
log_linear Indicates the model is in log-linear specification to the solver.

 

Returns:

Type Description
SolvedModel Solved model object with relevant methods attached.