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:
- 1.1. Model file language
- 1.2. Deriving models with
rise.microfound - 1.3. Zero-th order approximation: steady state and balanced-growth path
- 1.4. First-order perturbation
- 1.5. Higher-order perturbation
- 1.6. Solving
- 1.6.1. The signature
- 1.6.2. The retcode pattern
- 1.6.3. Picking a solver
- 1.6.4. Solver options
- 1.6.5. Order of approximation
- 1.6.6. Reducing the size of the system
- 1.6.7. Optimal policy
- 1.6.8. Occasionally-binding constraints
- 1.6.9. Perturbation strategy
- 1.6.10. Other options worth knowing
- 1.6.11. The diagnostic protocol when solve fails
- 1.6.12. Return-code reference
- 1.6.13. The retcode-aware pattern
- 1.7. Perturbation types for regime-switching models
- 1.8. Optimal policy
- 1.8.1. The modern distinctive
- 1.8.2. Declaring the planner’s problem
- 1.8.3. Switching parameters on leads and lags
- 1.8.4. Switching parameters in an objective
- 1.8.5. A lead that a lag multiplies
- 1.8.6. Equations outside the optimization
- 1.8.7. Robust policy: a policymaker that distrusts its model
- 1.8.8. Solve-time choices
- 1.8.9. Solver selection
- 1.8.10. Perturbation types
- 1.8.11. The planner-discount knife-edge
- 1.8.12. Loose commitment and stochastic replanning
- 1.8.13. Loose commitment and stochastic replanning are different problems
- 1.8.14. A linear-quadratic solver for stochastic replanning
- 1.8.15. When the structural matrices also switch
- 1.8.16. Solving a non-cooperative game without the policy-derivative machinery
- 1.8.17. A worked example: Tatiana’s monetary-fiscal game
- 1.8.18. Nonstationary optimal policy: geometric multipliers
- 1.8.19. Where to look next
- 1.9. Optimal (optimized) simple rules
- 1.10. Occasionally-binding constraints
- 1.11. Deterministic and quasi-deterministic solutions
- 1.12. Heterogeneous agents (HANK)
- 1.12.1. Heterogeneity axes
- 1.12.2. Deterministic axes
- 1.12.3. Individual variables
- 1.12.4. The individual block
- 1.12.5. Aggregation:
@Agg - 1.12.6. The aggregate block
- 1.12.7. Setting grid and transition values
- 1.12.8. Bin indicators: addressing a cell by position
- 1.12.9. The bracket window:
span - 1.12.10. Solving the steady state: the
hetengine - 1.12.11. Pruning the constants:
solve_prune_hank_constants - 1.12.12. Composing with regime switching
- 1.12.13. Worked example
- 1.13. Very large models
- 1.14. Model reduction
- 1.15. Template differentiation
- 1.16. Automatic translation of files