Julia BLP

I thoroughly enjoyed my introductory course on empirical industrial organization. I extended the course assignments into a clean implementation of the BLP method in the programming language Julia. There is an abundance of material on the relevant theory, but I was often stuck for hours trying to translate it into code. I found the existing template code to eschew clarity for speed. I am sharing my own code which I may one day turn into a proper introductory tutorial. I provide extensive documentation of every step and try to write equations that look as close to pen-and-paper equivalents while maintaining reasonable performance on the original BLP dataset. Julia has syntax similar to Python for general computing and uses Matlab’s syntax for math (inv(X’X), f.(X), A = [B C D], etc.). It also supports Greek letters, scripts, and subscripts using LaTeX syntax. The code is stylish but remains relatively fast and concise. I use less than 100 lines of code to estimate the demand side coefficients. Minimizing the objective function takes less than 5 minutes and it can be solved with or without the gradient function. Since the theory is well explained in numerous papers and notes, I do not attempt to replicate it.

Raymond Chiasson
Raymond Chiasson
PhD student in Economics

PhD student in economics at the University of Toronto.