GDSGE: A Toolbox for Solving DSGE Models with Global Methods

Welcome to GDSGE’s documentation!

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 (2023). It allows users to define economic models in compact and intuitive scripts, called gmod files (gmod stands for global model). It parses the script 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.

GDSGE can now run on MATLAB Online! Log into the MATLAB Online. And run in the MATLAB command window

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

These commands download the latest version of the toolbox, setup the mex compiler, and run the test examples. These produce all results in the companion paper Cao, Luo, and Nie (2023).

With MATLAB on a local machine, try running the leading example, Heaton and Lucas (1996), by downloading the toolbox source code and compiling the gmod file HL1996 by running in MATLAB


The toolbox source code can be found at:, where you can download the latest version of the toolbox, find detailed instructions for setting up the compiler, and submit issues.

Examples and documentation of the toolbox are provided below.

Lectures on the toolbox can be found at Lectures.

If you have comments, suggestions or coding questions for us, or would like to contribute GDSGE examples, please reach out to us at:


Indices and tables