This page links to computer codes from my papers and some snippets of code for dealing with well-known problems for which I struggled to find existing code with reasonable licensing terms; e.g. see this page for a discussion of problems with the Numerical Recipes's license terms.

Most of the codes are available on my GitHub profile.

  1. Fortran 90 and Matlab implementations of the non-stationary extensions of Tauchen (1986) and Rouwenhorst (1995) discretization methods described in my paper ,"Markov-Chain Approximations for Life-Cycle Models," (joint with Giovanni Gallipoli and Jutong Pan). Review of Economic Dynamics, 2019, 34, 186-201.
  2. R code to estimate a (possibly non-stationary) first-order, Markov chain from a panel of observations, according to the method in my paper "Nonlinear household earnings dynamics, self-insurance, and welfare," (joint with Mariacristina De Nardi and Gonzalo Paz-Pardo), forthcoming Journal of the European Economic Association.
  3. Fortran 90 code for my paper. "A Generalized Endogenous Grid Method for Non-Smooth and Non-Concave Problems"," The Review of Economic Dynamics, 2014, 17(2), 329-344.
  4. Fortran 90 module to find the zero of a function using either the simple Newton method or a hybrid Newton-bisection method. The Newton solver switches to the hybrid solver if it does not locate a zero within a given number of iterations.
  5. Fortran 90 module to sort a real array using the Quicksort method and provide the corresponding permutation of the array index. It adapts Walt Brainerd's code to compute the permuted index array.
  6. Fortran 90 module to find the index of the right interpolating node for each data point in an ordered array. It speeds up computation by exploiting the ordering of both the array of interpolating nodes and of the array of data points. It contains the subroutine sub_int_node for standard interpolation and the subroutine sub_integm_node for applying Carroll's (2006) Method of Endogenous Gridpoints with an occasionally-binding borrowing constraint. sub_integm_node returns index 0 to flag data points for which the borrowing constraint is binding and the solution can be computed analytically.