dsge_model: Define a Linear DSGE Model

View source: R/model-specification.R

dsge_modelR Documentation

Define a Linear DSGE Model

Description

Constructs a linear DSGE model object from a set of equations. Each equation is wrapped in obs(), unobs(), or state() to indicate the role of the left-hand-side variable.

Usage

dsge_model(..., fixed = list(), start = list(), derived = NULL)

Arguments

...

Equation specifications created by obs(), unobs(), and state().

fixed

Named list of parameter values to hold fixed (constrained) during estimation.

start

Named list of starting values for free parameters.

derived

Optional function mapping a named list of primitive parameter values to a named list of derived parameter values (e.g. beta_bar = beta * gamma^(-sigma_c)). Called by solve_dsge() at every solve so derived parameters track the current primitives during estimation. The returned list is concatenated with the primitives before equation coefficients are evaluated. Names returned by derived() may then appear directly inside equation coefficients alongside primitive parameters.

Details

A linear DSGE model is specified as a system of equations in which variables enter linearly but parameters may enter nonlinearly.

Use lead(x) or E(x) within formulas to denote the one-period-ahead model-consistent expectation of variable x.

The number of exogenous state variables (those with shocks) must equal the number of observed control variables.

Value

An object of class "dsge_model" containing:

equations

List of parsed equation objects.

variables

List with elements observed, unobserved, exo_state, endo_state.

parameters

Character vector of all parameter names.

free_parameters

Character vector of free (estimable) parameter names.

fixed

Named list of fixed parameter values.

start

Named list of starting values.

Examples

# Simple New Keynesian model
nk <- dsge_model(
  obs(p   ~ beta * lead(p) + kappa * x),
  unobs(x ~ lead(x) - (r - lead(p) - g)),
  obs(r   ~ psi * p + u),
  state(u ~ rhou * u),
  state(g ~ rhog * g),
  fixed = list(beta = 0.96),
  start = list(kappa = 0.1, psi = 1.5, rhou = 0.7, rhog = 0.9)
)


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