1. DSGE Modeling

A Markov-switching DSGE in the modern toolbox is a forward-looking nonlinear system

\[E_t f(y_{t+1}, y_t, y_{t-1}, \varepsilon_t, p(r_t)) = 0,\]

with \(r_t = 1, 2, \dots, h\) a Markov-chain regime, transition matrix \(Q_{i,j}(I_t)\) that can be constant or endogenous, and a parameter vector \(p(r_t)\) that can switch on one or more chains. The constant-parameter case is the trivial \(h = 1\) special case of the same engine; there is no separate constant-parameter code path.

The modern toolbox builds a DSGE via the dsge_model factory. Once you have the object, solve, filter, estimate, forecast, simulate, irf and the decompositions operate on it directly. The rest of this chapter covers the DSGE-specific machinery, one section at a time: