In this section I share some software code that I have written as part of my research, hoping that it may be useful to other researchers.

You are free to use and modify these programs, but I do not guarantee their reliability (If you find any bugs, please send me an email: [email protected]).

A Python Implementation of CompEcon

I have ported part of the functionality of Miranda and Fackler’s CompEcon toolbox from Matlab to Python. This is still work in progress, but there are many tasks that can now be done with this implementation.

The Python code is available in Github:, and can be installed using pip:

Some of the demos have already been ported. They are included in the Github repository as Jupyter notebooks. They are available at a dedicated website:

Link to website

bccr: A Python package to download data from BCCR

I have written a package to easily download and tidy data from the Central Bank of Costa Rica.  I have submitted this package to PYPI:

There are two APIs to download data (ServicioWeb and PaginaWeb), as well as a GUI.

For a quick start, check this page. You can check its documentation (in Spanish) in a dedicated website:

Link to website

Disclaimer: This package is NOT endorsed by the Central Bank of Costa Rica

macrodemos: A Python package to teach macroeconomics and econometrics

This package creates GUIs to illustrate concepts of macroeconomics and time series analysis. It can be installed from More details here.

pypi website.

Older code, no longer maintained

The following code is no longer maintained, but I have kept it public just in case it’s useful to someone.

bccr    [for R]

Originally, I tried to write the bccr package for R instead, but it was way easier to develop it with Python. Currently  I am not working in this R code, and  I have not submitted this package to CRAN, but you can access the latest R code in Github:

As an example, this file shows how to download data about lending interest rates.

Disclaimer: This package is NOT endorsed by the Central Bank of Costa Rica

Chebyshev basis interpolation    [for Matlab]

This zip file contains 5 m files:

  • basisChebyshev  defines a class to represent a unidimensional Chebyshev basis.
  • basis defines a class to represent a (possibly multidimensional) basis. So far, it only deals with Chebyshev bases, but in the future it will also define cubic spline and linear bases. To form a multivariate basis, the class allows to take the tensor product of the respective unidimensional bases, or to use Smolyak’s algorithm, as described by Judd, Maliar, Maliar, and Valero 2013.
  • funcApprox defines a subclass of “basis”; together with interpolation coefficients it is used to represent an approximated function.
  • demo01_basisChebyshev  and demo02_basis are demos to show how to use these classes.

These files are also avaliable in Github

For some theoretical results about Chebyshev polynomials, check this note.

Disclaimer: In writing these class definitions, I have benefited from reusing code from Miranda and Fackler’s CompEcon toolbox. Any mistakes in adapting their code are my own.

CompEconR [for R]

I have ported part of the functionality of Miranda and Fackler’s CompEcon toolbox from Matlab to R. This is work in progress; I am no longer developing this package, as I found it to be considerably slower than the original MATLAB version. Currently I am working on a Python version instead (see above).

Most of the advance was in the porting of the quadrature routines. The R code is available in Github: