Matlab, Python, Julia: What to Choose in Economics?

34 Pages Posted: 2 Oct 2018

See all articles by Chase Coleman

Chase Coleman

New York University (NYU) - Leonard N. Stern School of Business

Spencer Lyon

New York University (NYU) - Leonard N. Stern School of Business

Lilia Maliar

Stanford University - Department of Economics; Universidad de Alicante - Faculty of Economic and Business Sciences

Serguei Maliar

Stanford University - Department of Economics; Universidad de Alicante - Departamento de Fundamentos del Analisis Economico

Date Written: September 2018

Abstract

We perform a comparison of Matlab, Python and Julia as programming languages to be used for implementing global nonlinear solution techniques. We consider two popular applications: a neoclassical growth model and a new Keynesian model. The goal of our analysis is twofold: First, it is aimed at helping researchers in economics to choose the programming language that is best suited to their applications and, if needed, help them transit from one programming language to another. Second, our collections of routines can be viewed as a toolbox with a special emphasis on techniques for dealing with high dimensional economic problems. We provide the routines in the three languages for constructing random and quasi-random grids, low-cost monomial integration, various global solution methods, routines for checking the accuracy of the solutions, etc. Our global solution methods are not only accurate but also fast. Solving a new Keynesian model with eight state variables only takes a few seconds, even in the presence of active zero lower bound on nominal interest rates. This speed is important because it then allows the model to be solved repeatedly as one would require in order to do estimation.

Keywords: Dynamic programming, Global solution, High dimensionality, Julia, Large scale, Matlab, Nonlinear, Python, Toolkit, Value function iteration

JEL Classification: C6, C61, C63, C68, E31, E52

Suggested Citation

Coleman, Chase and Lyon, Spencer and Maliar, Lilia and Maliar, Serguei, Matlab, Python, Julia: What to Choose in Economics? (September 2018). CEPR Discussion Paper No. DP13210. Available at SSRN: https://ssrn.com/abstract=3259372

Chase Coleman (Contact Author)

New York University (NYU) - Leonard N. Stern School of Business ( email )

Suite 9-160
New York, NY
United States

Spencer Lyon

New York University (NYU) - Leonard N. Stern School of Business ( email )

Suite 9-160
New York, NY
United States

Lilia Maliar

Stanford University - Department of Economics ( email )

Landau Economics Building
579 Serra Mall
Stanford, CA 94305-6072
United States

Universidad de Alicante - Faculty of Economic and Business Sciences ( email )

Germán Edifcio Bernácer - Ground floor
Campus of San Vicente del Raspeig
Alicante, 03080
Spain

Serguei Maliar

Stanford University - Department of Economics ( email )

Landau Economics Building
579 Serra Mall
Stanford, CA 94305-6072
United States

Universidad de Alicante - Departamento de Fundamentos del Analisis Economico ( email )

Campus de San Vicente
Ap. Correos 99
03080 Alicante
Spain

Register to save articles to
your library

Register

Paper statistics

Downloads
1
Abstract Views
534
PlumX Metrics