Below you will find a bunch of example programs to solve various problems. These are meant to be illustrative and have limited documentation. If you find mistakes, please email me so I can fix them.

**Fortran**

I use Fortran as my main programming language. It is both fast and very easy to learn. Fortran was seriously updated in the 90s such that both F90 and F95 versions are very simple to use. One advantage over C/C++ is that arrays are passed by reference in functions and subroutines without having to use pointers. However, object oriented programming is limited. See the example with a module below for something that comes close to objects in C++.

- Discretizing a continuous AR(1) process using Tauchen (1986): Also included a do file showing how to estimate AR processes using minimum distance in Stata. Uses dcdflib.f library for probabilities. Based on Tauchen (1986)
- Creating a Fortran module project: This example allows to setup a project with makefile, source code, a good directory structure and as a bonus a little Stata do-file for reading Fortran output. Lots of examples of how to use modules to write flexible code. Look at the README file to get started.
- Classical MCMC of a probit model: The example uses the estimator proposed by Chernozhukov and Hong (2003) with

the adaptive Metropolis Hasting algorithm (Haario et al., 2001) for an otherwise classical problem: the estimation of a probit model. The MCMC algorithm proposed scales well when the problem involves many parameters or when the function has constraints and non-differentiable parts. Thanks to Jesus Bueren for pointing me to the work of Haario et al. (2001). - Infinite Horizon Optimal Consumption Rules: A simple example showing how to solve for optimal consumption in an infinite horizon consumption problem with stochastic earnings. Uses golden section search, Tauchen approximation to stochastic process and linear interpolation on a transformed grid.
- Life-cycle Precautionary Savings Model: A simple life-cycle example with stochastic earnings and mortality but exogenous retirement. The code both solves for optimal consumption as well as simulates a panel of agents. Useful as a starting point for a life-cycle consumption model.

**Stata**

I learned Econometrics using Stata. Stata is great for econometric analysis that does not involve heavy computations. Although it is expensive, I have simply been unable to get hooked on R or Python for data and econometrics.

**Python**

I have started using Python as a glue between programs. I use it sometimes as well to produce graphics and export results to LaTeX (to automate things on severs). My preferred distribution of Python for computing is Annaconda. Easy to install and provides a ton of libraries useful for my work.

I intend on populating this page with more code.

- Transforming a K-year transition matrix into a J-year transition matrix (markov.py, markov.pdf)