Personal tools
You are here: Home / Documentation and Support / Dynare++

Dynare++

Introduction

Dynare++ is a standalone C++ version of Dynare specialized in computing k-order approximations of dynamic stochastic general equilibrium models. The current version calculates the approximation of decision rules around the deterministic or stochastic steady state, runs simulations, IRFs and dumps all the results to a MAT file. It is able to check aprroximation errors of the solution.

Dynare++ is able to automatically calculate the first order conditions of an optimal policy given the constraints. The first order conditions are then solved as a usual model (k-order approximation, simulations, IRFs).

The main features of Dynare++ are:

  • completely standalone, no need to install MATLAB® or GNU Octave
  • output readable in MATLAB® and GNU Octave
  • contains a tensor library for evaluation of Faa Di Bruno formula
  • highly parallelized
  • takes advantage of kronecker product structure
  • links with ATLAS and LAPACK
  • includes numerical integration module
  • includes parser and derivator doing all derivatives symbolically
  • includes parser and derivator doing all derivatives symbolically

Documentation

The main source of information how to run Dynare++ and what it calculates can be now found in “DSGE Models with Dynare++. A Tutorial.” available on Documentation page or within the distribution.

The description of mathematics behind the perturbation method and Sylvester equation will appear in some journal(s).

Getting it

The package for Dynare comes with the latest version of Dynare++. Just install Dynare and you will also have Dynare++.

How We Tested

During Dynare++ development we put a great emphasis on testing. I developed  a special test suite for each module of Dynare++. There are three modules: sylvester module, tensor library, and k-order approximation.

The sylvester test suite contains 40 tests checking basic matrix operations, eigenvalue swapping and bubling, block diagonalization, doubling algorithm, and recursive algorithm.

The tensor library suite contains 35 tests checking basic tensor operations, tensor polynomial evaluation, and Faa Di Bruno formula for a stack of vector derivatives. The latter tests generate random vector monomial functions, calculate analytically their composition and all its derivatives, and compare with the derivatives calculated using the Faa Di Bruno formula.

The k-order module tests calculate the approximations and calculate residuals of the solved equations. The residuals should be close to zero. These tests check that the order of recovering of the derivatives is correct.

The numerical integration module test suite contains a few tests numerically integrating multidimensional functions with know integrals.

Also, we compared the results against the existing suites able to calculate approximations for orders higher than 4. The results for a simple RBC model were calculated using http://www.stanford.edu/~jinhehui/pertsolv.htm by H. Jin, and http://www.mindspring.com/~eswanson/perturbation.html by G. Anderson and E. Swanson. The derivatives calculated by Dynare++ differ only at 13-th significant digit for order 5, and at 10-th significant digit for order 6. We plan to compare more models.

Finally, I found a closed form solution for one equation asset pricing model. The derivatives were calculated by hand up to the order 5, and compared with Dynare++ results. The both results are the same.

The generated first order conditions of an optimal policy were tested on a simple 4 equation optimal taxation model, for which I wrote the FOCs by hand and then compared with Dynare++ internal data structures representing the formulas of the FOCs.

Running Times

The following three tables show the running times (in seconds) for three different models and three different machines. The Init stage includes parsing, derivating, and solving for deterministic steady state. The majority of Init time is spent in derivatives.

The first model is an RBC model with two capitals, labour, and consumption. Investment is subject to costs. It has 4 static variables, 3 predetermined, 3 forward looking and 1 shock.

Stage  P4, 2.0GHz, 256MB, Windows  P4 HT(2 logical), 2.8GHz, 256MB, Linux   2xXeon(4 logical),  2GHz, 1GB, Linux 
 Init  0.96  0.26  0.37
 Linear  0.0  0.0  0.01
 k2  0.1  0.02  0.04
 k3  0.28  0.08  0.13
 k4  1.61 (was 2.54)  0.43  0.77 (was 1.41)
 k5  9.98 (was 30.6)  4.0 (was 10.3)  6.84 (was 15.3)
 k6  55.02 (was 418.0)  20.21 (was 165.6)  92.95 (was 251.0)
 Sim 15.4   4.4  4.71

 

 The second model is a simple optimal portfolio problem with four assets. The portfolio owner's budget constraint includes stochastic yields, buy and sell, and consumption. The trading is subject to deterministic liquidity costs. The model has 14 equations, 12 predetermined, 10 forward-looking including 8 variables at both t-1 and t+1, and four shocks.

 Stage P4, 2.0GHz, 256MB, Windows  P4 HT(2 logical), 2.8GHz, 256MB, Linux    2xXeon(4 logical),  2GHz, 1GB, Linux 
 Init  1.44   0.65  0.86
 Linear  0.01  0.01  0
 k2  0.11  0.05  0.07
 k3  0.86 (was 2.04)  0.33 (was 0.76)  0.54 (was 1.22)
 k4  13.84 (was 62.08)  7.8 (was 23.9)  8.44 (was 28.7)
 k5  265.6 (was 1983.0) 116.1 (was 1716)  157.7 (was 906, 1467)
 Sim  2200.2  704  742

 

The third model is Global Economy Model (GEM) by D. Laxton and P. Pesenti. It has 246 equations, 134 static variables, 88 predetermined, 51 forward-looking including 27 at both t-1 and t+1, and 13 shocks.

Stage  P4, 2.0GHz, 256MB, Windows  P4 HT(2 logical), 2.8GHz, 256MB, Linux    2xXeon(4 logical), 2GHz, 1GB, Linux 
 Init  51.06 29.23 (was 38.88)  35.7 (was 51.63)
 k1  0.75 0.4  0.57
 k2  40.1 (was 114.5) 35.73 (was 230.51)  22.2 (was 64.4)
 Sim 365 150.7 135.3

License

All code in directories dynare++/parser and dynare++/utils is distributed under Lesser General Public License. All other code and documentation is distributed under General Public License. This implies that whenever you use code from a directory other than parser and utils, you have to distribute the resulting document under GPL. This, of course, does not apply for papers containing results calculated by Dynare++.

All code and documentation is copyrighted to Ondra Kamenik.

Authors

Ondra Kamenik. The previous versions of Dynare++ used modules written by Michel Juillard. Starting from version 1.3.0 all code is done by Ondra. However, without Michel's inspiration and leadership, Dynare++ would not have evolved.

Document Actions