Skip to main content

Sequence-Space Jacobian Methods for Solving and Estimating Heterogeneous Agent Models

Project description

Sequence-Space Jacobian (SSJ)

SSJ is a toolkit for analyzing dynamic macroeconomic models with (or without) rich microeconomic heterogeneity.

The conceptual framework is based on our paper Adrien Auclert, Bence Bardóczy, Matthew Rognlie, Ludwig Straub (2021), Using the Sequence-Space Jacobian to Solve and Estimate Heterogeneous-Agent Models, Econometrica 89(5), pp. 2375–2408 [ungated copy].

Requirements and installation

SSJ runs on Python 3.7 or newer, and requires Python's core numerical libraries (NumPy, SciPy, Numba). We recommend that you first install the latest Anaconda distribution. This includes all of the packages and tools that you will need to run our code.

To install SSJ, open a terminal and type

pip install sequence-jacobian

Optional package: There is an optional interface for plotting the directed acyclic graph (DAG) representation of models, which requires Graphviz for Python. With Anaconda, you can install this by typing conda install -c conda-forge python-graphviz.

Using SSJ: introductory notebooks

To learn how to use the toolkit, it's best to work through our introductory Jupyter notebooks, which show how SSJ can be used to represent and solve various models. We recommend working through the notebooks in the order listed below. Click here to download all notebooks as a zip.

  • RBC
    • represent macro models as collections of blocks (DAG)
    • write SimpleBlocks and CombinedBlocks
    • compute linearized and non-linear (perfect-foresight) impulse responses
  • Krusell-Smith
    • write HetBlocks to represent heterogeneous agents
    • construct general-equilibrium Jacobians manually
    • compute the log-likelihood of the model given time-series data
  • One-asset HANK
    • adapt an off-the-shelf HetBlock to any macro environment using helper functions
    • see a more advanced example of calibration
  • Two-asset HANK
    • write SolvedBlocks to represent implicit aggregate equilibrium conditions
    • re-use saved Jacobians
    • fine tune options of block methods
  • Labor search
    • example with multiple exogenous states
    • shocks to transition matrix of exogenous states


If you'd like to learn more about Python, its numerical libraries, and Jupyter notebooks, the introductory lectures at QuantEcon are a terrific place to start. More advanced tutorials for numerical Python include the SciPy Lecture Notes and the Python Data Science Handbook. There are many other good options as well: thanks to Python's popularity, nearly limitless answers are available via Google, Stack Overflow, and YouTube.

If you have questions or issues specific to this package, consider posting them on our GitHub issue tracker.

For those who used our pre-1.0 toolkit, which had a number of differences relative post-1.0, you can go back to our early toolkit page if needed.


The current development team for SSJ is

  • Bence Bardóczy
  • Michael Cai
  • Matthew Rognlie

with contributions also from Adrien Auclert, Martin Souchier, and Ludwig Straub.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sequence-jacobian-1.0.0.tar.gz (74.4 kB view hashes)

Uploaded Source

Built Distribution

sequence_jacobian-1.0.0-py3-none-any.whl (90.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page