GDP nowcasting, also on your own!

By D. Thomakos

The "DIY GDP forecasting engine" of our previous post was very well received so a nowcasting engine was the natural next step! The approach of constructing this new engine was similar to the one before: point to DeepSeek, ask for the outline of the code, make amends, repeat, debug twice (the machine and myself), debug again (myself only!) and the final product is ready for your try-outs and amendments. The variable of interest is the US real GDP growth and the nowcasting variables are weekly ones: the federal funds rate, the market yield on 10-year US treasuries (constant maturity), the deposits of all commercial banks, the commercial and industrial loans of all commercial banks and the consumer loans of all commercial banks. Yes, they are all banking variables but they they are weekly (Wednesdays) and they reflect the opportunity cost of money and availability of credit. Now you can obviously change the variables to include your own - but you will have to tweak the code too! The model is a MiDaS-style ARDLX regression with weekly lags aligned per quarterly GDP growth observation, and lags of the GDP growth itself. It is very straightforward once the data are set-up correctly, and because of the many variables involved I am using an ElasticNet approach to estimate the parameters - you can amend and automate the estimation for sure but for now some things are hardcoded.

 

For the backtesting I am using the MSE, MAE, the percentage of correct sign predictions and the correlation between actual and predicted values; the real-time, nowcast follows the backtesting. As in the previous post, play around with the parametrizations to see how different forecasts have different properties when evaluated. This is a tool for further exploration, be that in Python coding, research or teaching. Comments and suggestions are always welcomed, and I hope that you will enjoy it. A sample output appears below as is the link for the file in my github repository.

 

image