Increases in computational power offer economists new and powerful tools in estimating intractable econometric models. But many of the routines most commonly used to solve the large systems of equations that macro economists are often concerned with can be extremely computationally intensive. The computational challenge is an effort to try to develop and understand a set of best practices for the non-programmer economist who wants to use computers to conduct analysis. Graduate students in the UO Department of Economics developed basic code to estimate a probit model using Bayesian techniques including the implementation of a Metropolis-within-Gibbs posterior simulator across a variety of programming languages in order to improve upon baseline code. Among the findings:
- Inverting matrices is costly, and “canned” routines in all languages can be inefficient. Knowledge of the particular computational problem, such as the structure of a matrix, and application of appropriate decomposition can greatly improve computational time.
- By eliminating or streamlining intensive routines such as matrix inversion and calculation of pdfs each of the programming languages considered (Julia, Gauss, MATLAB, and Python) decreased the time taken to run the program by factors ranging from approximately 12 to 6.
- Move routines outside of loops if they do not need to be done repeatedly. For example, one should create storage spaces for estimation results before running the loop rather than appending to the storage matrices in each iteration. While computers are exceptional at repetition, eliminating redundancies within loops can significantly increase computational speed.
Slides from the presentation can be found here.