solve_dsge: Solve a Linear or Linearized DSGE Model

View source: R/solve-klein.R

solve_dsgeR Documentation

Solve a Linear or Linearized DSGE Model

Description

Computes the state-space solution of a DSGE model using the Klein (2000) method. Accepts both linear models (dsge_model) and nonlinear models (dsgenl_model). For nonlinear models, the steady state is computed and the model is linearized automatically.

Usage

solve_dsge(model, params = NULL, shock_sd = NULL, tol = 1e-06, order = 1L)

Arguments

model

A dsge_model or dsgenl_model object, or a Dynare model imported with read_dynare().

params

Named numeric vector of parameter values. If NULL, uses the model's fixed and start values (for an imported Dynare model, its calibration).

shock_sd

Named numeric vector of shock standard deviations. If NULL, defaults to 1 for all shocks (for an imported Dynare model, the standard deviations from its shocks block).

tol

Tolerance for classifying eigenvalues as stable (|lambda| < 1 + tol). Default is 1e-6.

order

Integer. Approximation order: 1 (default), 2 for second-order, or 3 for third-order perturbation. Orders 2 and 3 require a dsgenl_model.

Details

The stable solution is computed by cyclic reduction (as Dynare's cycle_reduction option); if that fails, for example with unit roots or a singular lead matrix, the stable deflating subspace of the model's matrix pencil is found with the inverse-free spectral divide of Bai, Demmel and Gu (1997), which needs no QZ decomposition; an undetermined-coefficients iteration is the last resort. As in Dynare, eigenvalues with modulus up to 1 + 1e-6 count as stable, so unit roots are allowed. Saddle-path stability requires that all eigenvalues of H have modulus below 1 + tol.

For nonlinear models, the solver first computes the deterministic steady state, then linearizes the model via first-order Taylor expansion, and finally solves the resulting linear system.

Value

An object of class "dsge_solution" containing:

G

Policy matrix (n_controls x n_states).

H

State transition matrix (n_states x n_states).

M

Shock coefficient matrix (n_states x n_shocks).

D

Observation selection matrix.

eigenvalues

Complex vector of eigenvalues.

stable

Logical: is the system saddle-path stable?

n_stable

Number of stable eigenvalues.

params

The parameter values used.

model

Reference to the model object.


dsge documentation built on Sept. 25, 2026, 5:08 p.m.