CompEcon

I’ve been working from time to time on porting from Matlab to Python the CompEcon toolbox that comes with the textbook by Miranda and Fackler (2002).

A major difference in this implementation is that much of the code is object-oriented, providing classes to represent:

  • Interpolation bases: Chebyshev, Spline, and Linear
  • Dynamic programming models: with discrete and/or continuous state and action variables
  • Nonlinear problems
  • Optimization problems

Some other differences are:

  • The solution of dynamic models is returned as a pandas dataframe, as opposed to a collection of vectors and matrices.
  • Some additional functionality is included, most notably for Smolyak interpolation.
  • Basis objects are callable, so they can be used to interpolation function by “calling” the basis.

This work is far from complete, yet there is some progress: check the list of Jupyter notebooks below to see which demos have already been replicated with the Python version. The actual Jupyter notebooks can be downloaded from the GitHub repository of the toolbox; here, you can also see their content thanks to nbviewer. Clicking on the nbviewer menu you will be able to download specific notebooks too (without getting the full repository from Github).

To start using the toolbox, you need to install it using pip –which will be in your computer if you’ve installed Anaconda–, by typing:

pip install compecon

at a terminal point.