GDSGE is a toolbox that solves nonlinear Dynamic Stochastic General Equilibrium (DSGE) models with a global method based on the Simultaneous Transition and Policy Function Iteration (STPFI) algorithm introduced in Cao, Luo, and Nie (2020). It allows users to define economic models in compact and intuitive scripts, called gmod files (gmod stands for global model). It parses the scripts into dynamic libraries which implement the actual computations (policy function iterations and Monte Carlo simulations) efficiently in C++, and provides a convenient MATLAB interface to researchers.
The toolbox can be used to solve models in macroeconomics, international finance, asset pricing, and related fields.
See the toolbox website for examples and documentation.
-
Windows / macOS
-
MATLAB ver>=2017b. MATLAB toolbox: Curve Fitting
-
Upload your gmod file following the instruction here: GDSGE: A Toolbox for Solving DSGE Models with Global Methods โ GDSGE Homepage
-
Windows / macOS
-
MATLAB ver>=2017b. MATLAB toolboxes: Symbolic Math, Curve Fitting
-
Visual C++ 2019 / Intel C++ Compiler 2017 or other MATLAB-compatible C++ compilers
First, Configure your mex C++ compiler by running in MATLAB
mex -setup c++
Then, acquire the source code by cloning the git repository:
git clone https://github.com/gdsge/gdsge
Next, in MATLAB, change directory to gdsge/tests, run
runtests
which runs all the tests and produce all results in the companion paper Cao, Luo, and Nie (2020).
To compile a gmod file, add folder "source" to MATLAB search path and run gdsge_codegen after changing the working directory to the one that contains the gmod file. For example, suppose you have located tests/HeatonLucas1996 with HL1996.gmod in the working directory, then simply run
gdsge_codegen('HL1996')
which will generate all the source codes and call the C++ compiler to compile the mex files.
GDSGE is released under the Apache License, Version 2.0, which is available at http://www.apache.org/licenses/LICENSE-2.0. In short, this license allows you to use, compose and distribute the GDSGE compiler or generated codes freely. However, it is requested that the companion paper be cited:
Cao, Dan and Luo, Wenlan and Nie, Guangyu, Global DSGE Models (April 1, 2020). Available at SSRN: https://ssrn.com/abstract=3569013 or http://dx.doi.org/10.2139/ssrn.3569013
GDSGE relies on the following external libraries, with their licenses described below and attached under folder licenses/:
-
Adept: A combined automatic differentiation and array library for C++.
Licensed under the Apache License, Version 2.0. Citation to the academic paper:
- Hogan, R. J., 2014: Fast reverse-mode automatic differentiation using expression templates in C++. ACM Trans. Math. Softw., 40, 26:1-26:16.
-
CoDoSol: a bound-constrained nonlinear equations solver.
Citation to the academic paper:
- Bellavia, S., M. Macconi, and S. Pieraccini (2012). Constrained dogleg methods for nonlinear systems with simple bounds. Computational Optimization and Applications 53(3), 771โ794.
-
myppual: Construct and Evaluate splines in ppform at flexible vector-valued dimensions, table look-up index, and spline dimension reduction in both vectorized pure MATLAB code and CMEX implementation.
Copyright (c) 2014 Jinhui Bai ([email protected]) and Wenlan Luo ([email protected])
-
v2struct: Pack/Unpack Variables to/from a scalar structure.
Copyright (c) 2014, Adi Navve, released under the MATLAB File Exchange License (BSD License)
-
flat_hash_map: Copyright Malte Skarupke 2017.
Distributed under the Boost Software License, Version 1.0 (http://www.boost.org/LICENSE_1_0.txt)
-
Intel Math Kernel Library.
Licensed under the Intel Simplified Software License (Version February 2020)