Skip to content

SparseGridsForDynamicEcon/SparseGrids_in_econ_handbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sparse Grids for Dynamic Economic Models

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.

Authors

The full review article can be found here

Illustrative example

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

\begin{align*} f_d(\vec{x}) = \max(0,1-e^{\frac{1}{2}-(\prod_{i=1}^d(x_i+\frac{1}{5}))^{\frac{1}{d}}}),;,\text{with},\vec{x}={x_1,\dots,x_d}\in[0,1]^d e\nd{align*}

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))

Usage

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:

Generic badge

as well as a plain python script, which can be executed from the command line:

Generic badge 2

The benchmark IRBC model code can be found here:

Generic badge 3

The benchmark IRBC model code, parallelized with MPI, can be found here:

Generic badge 4

The benchmark Aiyagari model code can be found here:

Generic badge 4

Prerequisites / Installation

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

Support

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

Citation

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}
}

About

Example codes for the Handbook chapter "Sparse Grids for Dynamic Economic Models" (Oxford Research Encyclopedia of Economics and Finance)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published