In 2015, economists at the Federal Reserve Bank of New York (FRBNY) published FRBNY’s most comprehensive and complex macroeconomic models, known as Dynamic Stochastic General Equilibrium, or DSGE models, in Julia.
In their words:
“Julia has two main advantages from our perspective. First, as free software, Julia is more accessible to users from academic institutions or organizations without the resources for purchasing a license. Now anyone, from Kathmandu to Timbuktu, can run our code at no cost.”
“Second, as the models that we use for forecasting and policy analysis grow more complicated, we need a language that can perform computations at a high speed. Julia boasts performance as fast as that of languages like C or Fortran, and is still simple to learn. We want to address hard questions with our models—from understanding financial markets developments to modeling households’ heterogeneity—and we can do so only if we are close to the frontier of programming.”
“We tested our code and found that the model estimation is about ten times faster with Julia than before, a very large improvement. Our ports (computer lingo for “translations”) of certain algorithms, such as Chris Sims’s gensys (which computes the model solution), also ran about six times faster in Julia than the … versions we had previously used.”
Furthermore, FRBNY’s ‘solve’ test ran 11 times faster in Julia than with their legacy system. This performance improvement is crucial because this particular test is run hundreds of thousands of times.
What makes Dynamic Stochastic General Equilibrium (DSGE) models so important and complex?
DSGE models are used to provide a structural view of the macroeconomy and forecast everything from economic growth to consumer spending and investment. The growing complexity of the US and global economy combined with dramatic increases in the size and complexity of data have made it necessary to develop ever more powerful tools to analyze and understand the relationship among economic variables.
FRBNY economists found that Julia allowed them to write more generic and concise code, resulting in better code maintenance. They reported that their code base had reduced to approximately half in size. While designing the package, the analysts found a number of Julia features favorable towards writing economic models:
Flexible and powerful type system that provides a natural way to structure and simplify codebase
Multiple dispatch, which allowed them to write more generic code
A powerful compiler that boosts performance
One result of this research is DSGE.jl, a Julia language package that facilitates the solution and Bayesian estimation of DSGE models.
Julia is helping the Federal Reserve Bank of New York estimate economic activity and provide policy recommendations that are more efficient, accurate and effective.