Sparse grid methods are a versatile tool to compute recursive equilibria in dynamic stochastic economic models. This code repository contains materials accompanying the review article entitled "Sparse grids for dynamic economic models".
The goal of this repository is to make sparse grid methods easily accessible to the computational economics and finance community. Thus, all illustrative code examples are using Tasmanian, a high-quality open source sparse grid library.
- Johannes Brumm (Chair of Macroeconomics, Karlsruhe Institute of Technology)
- Christopher Krause (Chair of Macroeconomics, Karlsruhe Institute of Technology)
- Andreas Schaab (Economics division, Columbia Business School)
- Simon Scheidegger (Department of Economics, University of Lausanne)
Analytical Example: To foster the basic intuition on how to use sparse grids as approximation method, we demonstrate their ability to efficiently interpolate the following n-dimensional (non-smooth) function
We generate sparse grid as well as adaptive sparse grid approximations to the function and measure their accuracy as follows: We randomly generate 10,000 uniformly distributed test points, and compute the maximum error and the L2-error.
Benchmark model in discrete time: To illustrate how (adaptive) sparse grids can be applied to solve economic models in discrete time, we provide an (MPI-parallelized) example in python, which solves a multi-country real business cycle model with and without irreversible investment, where the former is presented in Section 3 of the review article (for more details on this model, see also Brumm & Scheidegger (2017)).
Benchmark model in continuous time: To illustrate how (adaptive) sparse grids can be applied to solve economic models in continuous time, we provide an example which solves an Aiyagari-type model with a jump in the capital tax rate, as presented in Section 4 of the review article (for more details on this model, see also Schaab (2020))
We provide implementations which use python 3.
First, we provide an implementation of an analytic function in two forms. A jupyter-notebook that is self-contained:
as well as a plain python script, which can be executed from the command line:
The benchmark IRBC model code can be found here:
The benchmark IRBC model code, parallelized with MPI, can be found here:
The benchmark Aiyagari model code can be found here:
To run the code with the analytical examples, follow the instructions below. For instructions on how to run the benchmark international real business cycle (IRBC) model, see the corresponding instructions here: IRBC README.
$ python3 -m pip install scikit-build packaging numpy --user (required dependencies)
$ python3 -m pip install Tasmanian --user (user installation)
$ python3 -m pip install Tasmanian (virtual env installation)
$ python3 -m pip install mpi4py (MPI, to run the IRBC model in parallel)
Further information on alternative installation procedures for TASMANIAN can be found here: https://tasmanian.ornl.gov/documentation/md_Doxygen_Installation.html
This work is generously supported by grants from the Swiss National Science Foundation under project IDs “New methods for asset pricing with frictions”, "Can economic policy mitigate climate change", and the Enterprise for Society (E4S).
Please cite this handbook in your publications if it helps your research:
Brumm, Johannes and Krause, Christopher and Schaab, Andreas and Scheidegger, Simon (2022); Sparse grids for dynamic economic models
@article{SG_in_econ_handbook,
author = {Brumm, Johannes and Krause, Christopher and Schaab, Andreas and Scheidegger, Simon},
title = {Sparse Grids for Dynamic Economic Models},
journal={Available at SSRN 3979412},
year = {2022}
}