Coder Social home page Coder Social logo

gdsge's Introduction

GDSGE: A Toolbox for Solving Global DSGE Models

The GDSGE Toolbox

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.

Run on MATLAB Online

First, log into your MATLAB Online

Then, download the toolbox release and unzip in the MATLAB command window:

websave('gdsge.zip','https://github.com/gdsge/gdsge/archive/refs/tags/v0.1.3.zip')
unzip gdsge.zip

Finally, change directory to the unzipped folder, set up the default mex compiler, and run tests in the MATLAB command window:

mex -setup c++
cd gdsge-0.1.3/tests
runtests

This produces all results in the companion paper Cao, Luo and Nie (2023)

Requirements for the local compiler

  • Windows / macOS

  • MATLAB ver>=2017b. MATLAB toolboxes: Symbolic Math, Curve Fitting

  • One of the following C++ compilers:

    • Windows: MinGW64 C++ (installed via MATLAB Add-Ons); Visual Studio C++ Compiler 2019, 2022 (community version is fine); Intel C++ Compiler 2017 or newer
    • Linux: g++; MATLAB online
    • macOS: g++8.5 (installed via homebrew; see the instruction for how to setup the g++8.5 compiler)
      • macOS with Apple Silicon processors is not supported.

Installation of the local compiler

First, Configure your mex C++ compiler by running in MATLAB

mex -setup c++

(For macOS users, see the instruction for how to setup the g++8.5 compiler.)

Then, acquire the source code by cloning the git repository (the local folder name should not contain spaces):

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 (2023).

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.

License

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:

Dan Cao, Wenlan Luo, and Guangyu Nie (2023). Global DSGE models. Review of Economic Dynamics, forthcoming. Available at: https://www.sciencedirect.com/science/article/pii/S1094202523000017

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)

  • Eigen: a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. Starting from the 3.1.1 version, it is licensed under the MPL2

gdsge's People

Contributors

marchaser avatar dc448 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.