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. Bound arguments for a user solver
- 1.6.5. Solver options
- 1.6.6. Order of approximation
- 1.6.7. Reducing the size of the system
- 1.6.8. Optimal policy
- 1.6.9. Occasionally-binding constraints
- 1.6.10. Perturbation strategy
- 1.6.11. Other options worth knowing
- 1.6.12. The diagnostic protocol when solve fails
- 1.6.13. Return-code reference
- 1.6.14. Deferred higher-order fallback storage
- 1.6.15. 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. Normalized welfare
- 1.8.7. Equations outside the optimization
- 1.8.8. Robust policy: a policymaker that distrusts its model
- 1.8.9. Solve-time choices
- 1.8.10. Solver selection
- 1.8.11. Perturbation types
- 1.8.12. The planner-discount knife-edge
- 1.8.13. Loose commitment and stochastic replanning
- 1.8.14. Loose commitment and stochastic replanning are different problems
- 1.8.15. A linear-quadratic solver for stochastic replanning
- 1.8.16. When the structural matrices also switch
- 1.8.17. Solving a non-cooperative game without the policy-derivative machinery
- 1.8.18. A worked example: Tatiana’s monetary-fiscal game
- 1.8.19. Nonstationary optimal policy: geometric multipliers
- 1.8.20. Where to look next
- 1.8.21. Stationary observables and unconditional rule losses
- 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 number of cells
- 1.12.10. The bracket window:
span - 1.12.11. Solving the steady state: the
hetengine - 1.12.12. Pruning the constants:
solve_prune_hank_constants - 1.12.13. Composing with regime switching
- 1.12.14. Worked example
- 1.13. Very large models
- 1.14. Model reduction
- 1.14.1. What the reduction does
- 1.14.2. The basis
- 1.14.3. Regime switching
- 1.14.4. Occasionally-binding constraints
- 1.14.5. Higher orders
- 1.14.6. Using a reduction on another model
- 1.14.7. Supplied bases and projections
- 1.14.8. Contracted derivatives
- 1.14.9. Validating a reduction
- 1.14.10. Options of
build - 1.14.11. Limits
- 1.15. Template differentiation
- 1.16. Automatic translation of files