Simulating dynamic general equilibrium models

Example files


by Matteo Iacoviello

LAST UPDATED: Monday, 24 January, 2005



In order for you to learn how to practice with dynamic stochastic general equilibrium models, I suggest you learn to use the toolkit by Harald Uhlig, described on his webpage.


Most of these codes are written for the Graduate courses EC751: Macroeconomic Theory and EC861: Monetary Theory and Policy that I teach at Boston College.


In order to understand how the toolkit works and, above all, how rational expectations models work, you have to read Uhlig (1997) “A Toolkit for Analyzing Nonlinear Dynamic Stochastic Models Easily'' . Uhlig’s approach is based upon the method of the undetermined coefficients.



I suggest you to take the following steps:


1)     Make sure you have a copy of MATLAB

2)     Create a directory in your computer, say C:\UHLIG

3)     Download the Harald Uhlig’s toolkit files (Uhlig’s files are also available on his webpage)

4)     Unzip them in C:\UHLIG

5)     Open Matlab

6)     From Matlab, click File – Set Path – Add Folder – then add your c:\uhlig folder

7)     Create another directory in your computer, say C:\MATTEO

8)     Repeat step 6, adding C:\MATTEO

9)     Copy in that directory the files containing the programs necessary to run the simulations




Below are the programs that need to go into C:\MATTEO


To plot the impulse responses of all the models below:


(you have to edit this file if you like to change color of the impulse responses)



0) Real business cycle model with no capital depreciation (and exogenous labor)

rbcsimple.m  (which calls the rbcsimple_go.m file, which you will have to download too)



1) Sidrauski money in utility function model, based on functional forms in Walsh, first edition

sidrauski.m  (which calls the Sidrauski_go.m file, which you will have to download too)


New version added October 2003, based on functional forms given in Walsh, “Monetary Theory and Policy”, MIT Press, second edition

sidrauski2.m  (which calls the Sidrauski2_go.m file, which you will have to download too)

For details, see also my graduate monetary theory lecture notes (Chapter 3)



2) Cash in advance model

cia.m  (which calls the cia_go.m file)

For details, see also my graduate Monetary Theory lecture notes (Chapter 3)



3) Optimal interest rate rules model by Giannoni and Woodford (2002)

giannoni.m (which calls the giannoni_go.m file)

For details, see also my graduate Monetary Theory lecture notes (Chapter 6)



4) Leeper-Woodford model of interaction between monetary and fiscal policy

leeper.m (which calls the leeper_go.m file)

For details, see also my graduate Monetary Theory lecture notes (Chapter 7)



5) Credit cycle model based on my EC751 lecture notes (simplified version of Kiyotaki and Moore, JPE, 1997)

kiyotaki.m (which calls the kiyotaki_go.m file)

For details, see also my EC751 Graduate Macroeconomics lecture notes (Ch 3)



6) 3-equations, reduced form of the DNK (Dynamic New-keynesian) model based as described in McCallum AER paper (2001)

mc.m (which calls the mc_go.m file)

Slightly simpler version with 3 shocks only and no y(t-1) in IS curve (mc3.m and mc3_go.m)




7) Dynamic-new-Keynesian model with capital and habit formation and with productivity, monetary and cost-push shocks

dnwk.m which calls

- either dnwk_go.m: simplest version of the model, like in my EC751: graduate Macroeconomics lecture notes (Ch 4)

- or dnwk_p_go.m: version of the model with ad-hoc lags, with inflation and output chosen one period in advance, as in Boivin-Giannoni, “Has Monetary Policy Become More Effective?”, 2003)



8) Dynamic new-Keynesian model without capital, inflation chosen ONE period in advance and output chosen TWO periods in advance (like in Rotemberg-Woodford 1997 NBER Macro Annual paper)

dnlag.m (which calls the dnlag_go.m file)



9) Mankiw-Reis sticky information model (QJE, 2002)

mankiwreis.m (which calls the mankiwreis_go.m file)



10) RBC (Real business cycle) model with capital adjustment costs and to calculate the asset pricing statistics as in “Martin Lettau: Inspecting The Mechanism: Closed-Form Solutions For Asset Prices In Real Business Cycle Models”, Economic Journal, 2003

rbcfull.m (which calls rbcfull_go.m file and the rbcfull_sim.m file)




My own personal version of how these models can be solved (based on the eigenvalue-eigenvector decomposition) is summarized in this pdf file, not to be quoted for whatsoever reason. This three pages handout refers to a Matlab file that runs the example model that I solve by hand with the above method.


This programs come as they are, and I accept no responsibility if your paper is rejected, your representative agent kills you, your country enters a recession because of these files.

However, if you happen to use these files, find any bugs or want to give me comments and suggestions you can email me at, thanks!



Back to my home page