On this page I put random bits of code I've used for a variety of projects. There is no support or guarantee that any of this code will work, so use at your own risk.

Minimization Algorithms

In many empirical projects one needs to minimize a fairly complex criterion function. To do this I often use a kit of minimizers. I am putting them in one place so that other researchers can have access to them. I did not write any of this code myself.

1. FminOS

A version of a Nelson-Mead algorithm (i.e. fminsearch in MATLAB) with a little bit of stepsize increase to get over kinks. The code in Matlab. (thanks to Robin Lee for pointing this out).

2. Differential Evolution

I've found that this algorithm has a good combination of global minimizing and relatively fast convergence for smooth problems. The code in Matlab. (thanks to a paper by Pat Bajari for suggesting this algorithm).

3. Simulated Annealing

This code takes a while to run, and I have not had much luck with it. Here is the code in MATLAB and C. (thanks to Adam Rosen for pointing this one out)

4. Numerical Recipes Minimizers

This code was written by Bo Honore in GAUSS and replicates the minimizers in numerical recipes. The code in Gauss.


So you need to integrate over a function.

1. Halton Sequences

Many economic problems have monte-carlo integration in them, but it turns out using a uniform grid can be better than using a random sampling procedure. The following code in MATLAB constructs Halton Sequences in N-dimensions. (thanks to Ali Yurukoglu for pointing this out).