Code

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: randall.romero@outlook.com).

CompEcon [for Python]

I have ported part of the functionality of Miranda and Fackler’s CompEcon toolbox from Matlab to Python. This is work in progress.

Most of the advance is in the porting of solvers for nonlinear problems and for dynamic programming problems. The Python code is available in Github:

https://github.com/randall-romero/CompEcon-python

Some of the demos have already been ported. They are included in the Github repository as Jupyter notebooks. They are available here in html format.

 

bccr    [for R]

Currently I’m writing a package to easily download and tidy data from the Central Bank of Costa Rica.  I have not submitted this package to CRAN, but you can access the latest R code in Github:

https://github.com/randall-romero/bccr

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

https://github.com/randall-romero/Interpolation

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:

https://github.com/randall-romero/CompEconR