Additional software for Dynare programs
Content:
- Alternative version of the disp_dr.m file. >
- Solving with Dynare: Programs related to solving with Dynare (accuracy, loops, IRFs).
- A zip file with these programs can be downloaded
here
- Looping over Dynare++
- A zip file with these programs can be downloaded
here
- Estimating with Dynare: Programs related to estimating with Dynare (solving, generating fake data, & estimation).
- A zip file with these programs can be downloaded
here
- Solving models with heterogeneous agents with Dynare
Alternative to disp_dr.m file
To use this file simply replace (after having made a backup) the
disp_dr.m file provided by Dynare with this one. My version is different in that it (i) writes all coefficients to the screen,
even if they are smaller than 1e-06 and (ii) writes the coefficients to the file decision.mat exactly the way you see them on the screen
2. programs related to solving with Dynare:
The purpose of these programs is twofold. First, there are some tricks that I found useful. For
example they make it possible to change parameter values within the Dynare (or Dynare++)
source file from within a Matlab program so you can loop over a range of values.
Second, they generate additional results, such as accuracy tests or state contingent IRFs
- dynareloop.m:
This Matlab program uses Dynare to solve the neoclassical growth model. You can change the parameters
of the model within the Matlab file. The program loops over one of them (risk aversion) and shows
how the IRFs or simulated series of consumption change if one varies this parameter.
- simul.m:
This Matlab program solves the standard growth model in four different ways (1st-order in levels,
2nd-order in levels, 1st-order in logs, & 2nd-order in logs) and plots simulated time series
in one graph). Key parameter values of the model can be adjusted within the Matlab file.
- irf.m:
This Matlab program shows how for a nonlinear model the IRF depends on the initial condition, the
size and sign of the shock, and the subsequent shocks in the benchmark simulation. Note that
Dynare only calculates the IRF at the steady state and so gives a limited idea about IRFs for
higher-order solutions
- accuracy.m:
This program shows how to implement the DHM and Euler equation errors
- dyneuler.m:
This program shows how to do the Dynamic Euler equation test
supporting files:
- *.mod
several Dynare source files used
- polfunction.m
external function to calculate policy function
- hernodes.m
generates Hermite Gaussian quadrature nodes and weights needed for accuracy tests
!!!!! This disp_dr file is an edited version corresponding to a particular version of Dynare
(downloaded July 2008). It will not work with (much) older versions and may not work with future versions.
Best is to edit the existing disp_dr file yourself (and only use this disp_dr file as an example on how to do it)
A zip file with these programs can be downloaded
here
3. Looping over Dynare++ files:
These programs show a similar trick as the one used above in Dynare programs that makes
it possible to change the parameters in a Dynare++ source file from within a Matlab file,
which for example makes it possible to loop over parameter values. As an example, it is
shown how increasing the perturbation order changes the simulated series of consumption
for both a model with a low riskaversion parameter (i.e. a pretty linear model) and a
model with a high riskaversion parameter (i.e. a pretty nonlinear model).
Unfortunately, the "trick" is not as easy as the one for Dynare programs but still very
doable
- mainpp.m:
This Matlab program explains the trick. It solves a standard growth model with Dynare++,
but allows the reader to set risk aversion, standard deviation shocks, order of perturbation, and
number of observations in the simulation in a separate Matlab program. (Of course, when the
user understands the trick he can easily adjust the programs to adjust more)
- mainpploopriskaversion.m:
This program uses the trick to loop over the perturbation order and two values of riskaversion
to show that increasing the perturbation order for a model with a low risk aversion has
little effect but increasing the perturbation order for a model with a high risk aversion
does have an effect
- mainpploopvariance.m:
This programs does the same as the previous program but now for two different values of the innovation variance.
It shows that to understand the effect of an increase in uncertainty on the mean of consumption correctly one needs
(for this model) at least a fourth-order approximation.
supporting files:
- standard_growth_model_block_begin.mod:
part of the Dynare++ source file used to build the complete one
- standard_growth_model_block_end.mod:
part of the Dynare++ source file used to build the complete one
A zip file with these programs can be downloaded
here
4. Estimating models with Dynare:
These programs are the ones used for the examples in the slides of the teaching notes page
- generatedata.m:
This Matlab program uses Dynare to solve the neoclassical growth model as programmed in the
Dynare source file dynaresolve.mod and then generates 5000 observations of fake data. It puts
5000 observations of log output in ydata.mat, 5000 observations of log capital in kdata.mat, 5000 observations
of log consumption in cdata.mat, and 5000 observations of log productivity in zdata.mat. It also puts
all four series in zckydata.mat. You can add measurement error to this file and you can change the
parameters of the Dynare source file from within this Matlab program.
- dynaresolve.mod:
Dynare source file used by generatedata.m
- dynareestimate*.mod: three different programs with different choices
A zip file with these programs can be downloaded
here