FREE NEWSLETTER: Econintersect sends a nightly newsletter highlighting news events of the day, and providing a summary of new articles posted on the website. Econintersect will not sell or pass your email address to others per our privacy policy. You can cancel this subscription at any time by selecting the unsubscribing link in the footer of each email.

posted on 13 May 2017

Forecasting With Julia

from Liberty Street Economics

-- this post authored by Abhi Gupta, Pearl Li, Erica Moszkowski, Marco Del Negro, and Marc Giannoni

A little more than a year ago, in this post, we announced DSGE.jl - a package for working with dynamic stochastic general equilibrium (DSGE) models using Julia, the open-source computing language. At that time, DSGE.jl contained only the code required to specify, solve, and estimate such models using Bayesian methods.

Now, we have extended the package to provide the additional code needed to produce economic forecasts, counterfactual simulations, and inference on unobservable variables, such as the natural rate of interest or the output gap. The old, pre-Julia version of the code, which was written in MATLAB and is posted here on Github, a public repository hosting service, also performed some of these functions, but not quite as fast.

So what does DSGE.jl version 2.0 do? Version 1.0 of the package just estimated the parameters of the model. While this is a necessary step, and perhaps the most challenging one from a computational point of view, it is by no means the end goal. The real questions that motivate the use of DSGE models are: What are output growth and inflation going to be over the next two years? What are the drivers of these forecasts? What were the causes of the slow recovery from the financial crisis (a slow recovery that, unlike most private forecasters, the FRBNY DSGE model predicted back in 2010)? What is the natural rate of interest - also known as r* - and how is it going to evolve in the future? We need to go beyond parameter estimation in order to address these questions.

The FRBNY DSGE is a linear state-space model. A state-space model is a dynamic system where the underlying “state of the economy," which we do not directly observe, evolves over time, and where the variables that we observe and forecast - such as real GDP growth - are a function of this state of the economy. If we want to make projections, we therefore need to come up with an estimate of the state of the economy today, and use it to guess the economy’s future evolution. If we want to also characterize the uncertainty about the model’s forecasts - that is, to construct the blue shaded areas in the charts in this earlier post - we need to take into account that we don’t quite know the current state of the economy or its evolution, and that even if we did know, future shocks will hit the economy. This chapter in the Handbook of Economic Forecasting provides an overview of the algorithm just described, which is implemented by the codes.

When we want to plot the history of latent variables such as the natural rate of interest, a guess about the current state of the economy is not enough. We also need to conduct inference on the state of the economy in the past. For this type of inference, known as “smoothing," we need another set of routines. The so-called “Kalman smoother" produces our average guess for the latent variables, while the “distribution smoother" produces the whole distribution. We build the former using an efficient algorithm developed by Koopman, and the latter using the approach of Durbin and Koopman (although code implementing an alternative approach by Carter and Kohn is also available). We use these very same techniques to extract the histories of the shocks that hit the economy over our estimation sample, and then use these histories to identify the drivers of economic fluctuations. Since all of these codes are also useful outside the realm of DSGE models, we made them available as a stand-alone package called StateSpaceRoutines.jl.

For those interested in the programming details, this technical post provides some information about the challenges we faced in writing the Julia code and how we addressed them. While the old estimation code was largely a direct port (in other words, a translation) of the original MATLAB code, we completely redesigned the forecast section to obtain code that is much faster and easier to use. Our efforts paid off to huge effect, with our most recent model running the full-distribution forecast step in approximately fifteen minutes, compared with the seventy minutes our old code took to perform the same tasks. In the technical post we discuss the design principles and Julia parallel computing tools that made these speedups possible.

LSE_2017_dsge-april_delnegro_2.5x3The Federal Reserve Bank of New York recently lent its expertise in code development to other central banks eager to learn about this new open-source computing language. In March, two of us traveled to give Julia workshops organized by QuantEcon at the Reserve Banks of Australia and New Zealand. The workshops covered Julia syntax, important features, and packages relevant to statisticians and economists, as well as our experience with Julia in the FRBNY DSGE team. All of the workshop materials can be found on Github. The two kangaroos shown in the photo to the left came back with us from the trip to Australia. Their names are An&Schorfheide (small kangaroo) and Smets&Wouters (large).


The views expressed in this post are those of the authors and do not necessarily reflect the position of the Federal Reserve Bank of New York or the Federal Reserve System. Any errors or omissions are the responsibility of the authors.

This post reflects the experience of the authors with Julia and MATLAB and does not represent an endorsement by the Federal Reserve Bank of New York or the Federal Reserve System of any particular product or service.


About the Authors

Gupta_AbhiAbhi Gupta is a senior research analyst in the Federal Reserve Bank of New York’s Research and Statistics Group.

Li_PearlPearl Li is a senior research analyst in the Bank’s Research and Statistics Group.

Moszkowski_ericaErica Moszkowski is a senior research analyst in the Bank’s Research and Statistics Group.

Del_negro_marcoMarco Del Negro is a vice president in the Bank’s Research and Statistics Group.

Giannoni_marcMarc Giannoni is an assistant vice president in the Bank’s Research and Statistics Group.

>>>>> Scroll down to view and make comments <<<<<<

Click here for Historical News Post Listing

Make a Comment

Econintersect wants your comments, data and opinion on the articles posted. You can also comment using Facebook directly using he comment block below.

Econintersect Contributors

Print this page or create a PDF file of this page
Print Friendly and PDF

The growing use of ad blocking software is creating a shortfall in covering our fixed expenses. Please consider a donation to Econintersect to allow continuing output of quality and balanced financial and economic news and analysis.

Keep up with economic news using our dynamic economic newspapers with the largest international coverage on the internet
Asia / Pacific
Middle East / Africa
USA Government



Analysis Blog
News Blog
Investing Blog
Opinion Blog
Precious Metals Blog
Markets Blog
Video of the Day


Asia / Pacific
Middle East / Africa
USA Government

RSS Feeds / Social Media

Combined Econintersect Feed

Free Newsletter

Marketplace - Books & More

Economic Forecast

Content Contribution



  Top Economics Site Contributor TalkMarkets Contributor Finance Blogs Free PageRank Checker Active Search Results Google+

This Web Page by Steven Hansen ---- Copyright 2010 - 2018 Econintersect LLC - all rights reserved