DSGE Models

Here you can find some codes and lecture notes on DSGE models. I wrote this material mainly to organize my codes and knowledge about DSGE models. I hope that sharing the material can help young researchers in setting up a model or writing the code. However, by no means this material is a substitute of a graduate course in Macro or of a textbook analysis.

These models are based on classic contributions in the macroeconomic literature, but they are not necessarily exact replicas. The impulse response functions generated by the models are only illustrative and they do not necessarily provide a serious quantiative evaluation of a given shock. Whenever possible, I use the same notation throughout the lecture notes: most variables are defined in the RBC or in the NK lecture notes.

For every model, click on the title and download a folder containing the Dynare code that simulates the model, an .m file that computes the steady state (console), and lecture notes where I derive the equations of the model and explain how to compute the steady state. First you should run the .m file to save the parameters and compute the steady state of the model, then you can run the Dynare file. Here you download Dynare. Here you find the Dynare reference manual and the excellent forum managed by Prof. Johannes Pfeifer where you can ask questions and find Dynare codes of famous DSGE models.

Comments and suggestions are welcome, especially if you find some inaccuracies or typos. Please write an email at valerio.nispilandi@bancaditalia.it

MODELS

Closed Economy

This model is a version of the RBC framework first developed by Kydland and Prescott (1982).

Price rigidities are introduced in the RBC framework described above, as in the textbook analysis by Woodford (2003) and Gali (2015).

This is a NK model with two agents, where only one of them has access to financial markets, along the lines of Gali, Lopez-Salido, and Valles (2007).

The NK model is augmented with a link between production and environment, as in Heutel (2012) and Annicchiarico and Di Dio (2015), which in turn build on the DICE model by Nordhaus.

The NK model is augmented with an extensive margin for employment, as in the Search and Matching model of Diamond (1982), Mortensen and Pissarides (1994) (DMP). The lecture notes and the code are a replica of Section 7 in Monacelli, Trigari, and Perotti (2010).

The NK framework is augmented with the banking sector of Gertler and Karadi (2011), in order to study QE policies.

I augment the NK model with trend growth and permanent TFP shocks. I show how to detrend non-stationary variables in order to make the solution of the model stationary.

The number of firms is made endogenous in the NK model, along the lines of Bilbiie, Ghironi, and Melitz (2012, 2019) and Bilbiie, Fujiwara, and Ghironi (2014) .

Open Economy

This is a model for a small open economy trading with the rest of the world, as in the textbook analysis by Uribe and Schmitt-Grohe (2017). Two versions are presented: in the first one international financial markets are complete, in the second one financial markets are incomplete.

A non-tradable good is introduced in the open-economy RBC model.

The open-economy RBC model is augmented with nominal rigidities, as in Gali and Monacelli (2005).

This is a model for the global economy featuring two countries, incomplete financial markets, and nominal rigidities, as in Benigno (2009).

ADDITIONAL NOTES

I show how to simulate the transition to a green (zero-emission) economy assuming perfect foresights.

I show how to linearize and log-linearize equations of a DSGE model around the deterministic steady state.

I give the intuitions of the Blanchard-Khan conditions for the solutions of DSGE models, providing some examples. I show how to solve a small DSGE model with the method of undetermined coefficients.

I explain the differences between the concepts of deterministic steady state, stochastic steady state, and ergodic mean in DSGE models. A .mod file shows how to compute these objects in Dynare.

I show how to write recursively the non-linear equations of the Calvo pricing model. In the Dynare code, I compare the Calvo and the Rotemberg frameworks.

I show how to optimize the parameters of a simple policy rule using Dynare.

The goal of these lecture notes is threefold. First, I show how to derive a second-order approximation of the baseline NK model, including a second-order approximation of the Phillips Curve. Second, I derive the quadratic welfare loss function, assuming that the steady-state distortion is small (as in Gali's Textbook, Chapter 5). Third, I derive the quadratic welfare loss function, assuming that the steady-state distortion is not small (as in Benigno and Woodford, 2005).

In the Dynare code, I show how to compute the optimal policy conditional on a given policy instrument. In the lecture notes, I show how to compute the steady state of the model, conditional on the policy instrument, as required by the Dynare routines.