FRBNY-DSGE / DSGE-2015-Apr

Replication files for Liberty Street Economics blog post "The FRBNY DSGE Model Forecast--April 2015"
http://libertystreeteconomics.newyorkfed.org/2015/05/the-frbny-dsge-model-forecast-april-2015.html
30 stars 24 forks source link

FRBNY DSGE Model (Version 990.2)

MATLAB code to estimate and forecast the model discussed in the Liberty Street Economics blog post "The FRBNY DSGE Model Forecast".

Running the Code

Running with Default Settings

All you need to do is run the file Main.m. This script will run the entire set of code, calling

Running with Modified Settings

If you would like to change defaults for estimation and forecasts, see spec_990.m. There, you can modify

Troubleshooting

Some common issues that may arise while running with default settings include:

Directory Structure

In the main folder, there exist the following directories to house code components:

Program Details

This section describes important programs in greater detail. If the user is interested only in running the default model and reproducing the forecast results, this section can be ignored.

This section focuses on what the code does and why, while the code itself (including comments) provides detailed information regarding how these basic procedures are implemented.

Estimation

Main Program: estimation/gibb_est_ant.m

Purpose: Finds modal parameter estimates and samples from posterior distribution.

Main Steps

Remark: In addition to saving each draw of the parameter vector, the estimation program also saves the resulting posterior value and transition equation matrices implied by each draw of the parameter vector. This is to save time in the forecasting step since that code can avoid recomputing those matrices. In addition, to save space, all files in save/ are binary files.

Forecasting

Main Program: forecast/forecast_parallel_est_ant.m

Purpose: Compute forecast distribution for the observables, sampling from the full posterior distribution of parameters and sampling exogenous shocks.

Main Steps

Remark: The code can be run in parallel or sequentially. Running in parallel requires the MATLAB parallel toolbox.

Plotting

Main Programs: plotting/forplot.m, plotting/plotPresentation.m

Purpose: Generate plots of observables.

Main Steps

Remark: Each time forplot.m is called, it will attempt to recompute the forecast means and bands, which takes some time. However, these are saved in save/ after the very first call to forplot.m. To use these saved Means and Bands structures and avoid recomputing, set useSavedMB=1 before running forplot.m.

Final Notes on MATLAB Versions and Toolboxes

In certain functions implemented in this program are Toolbox functions provided by Mathworks. If you are receiving errors in running these programs due to undefined functions, it is likely because you do not yet have access to these Toolboxes. For example, to run the forecasts in parallel (the default setting), you will need the parallel toolbox. Also, dlyap.m, a function to solve discrete-time Lyapunov equations, comes from the Control System Toolbox.

These programs are meant to be run in Matlab09a. While we have not attempted to run these programs using a more recent version of Matlab, it is possible that some of the Matlab-defined functions are not identical and thus may yield nonidentical results.

Disclaimer

Copyright Federal Reserve Bank of New York. You may reproduce, use, modify, make derivative works of, and distribute and this code in whole or in part so long as you keep this notice in the documentation associated with any distributed works. Neither the name of the Federal Reserve Bank of New York (FRBNY) nor the names of any of the authors may be used to endorse or promote works derived from this code without prior written permission. Portions of the code attributed to third parties are subject to applicable third party licenses and rights. By your use of this code you accept this license and any applicable third party license.

THIS CODE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT ANY WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. FRBNY IS NOT, UNDER ANY CIRCUMSTANCES, LIABLE TO YOU FOR DAMAGES OF ANY KIND ARISING OUT OF OR IN CONNECTION WITH USE OF OR INABILITY TO USE THE CODE, INCLUDING, BUT NOT LIMITED TO DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, SPECIAL OR EXEMPLARY DAMAGES, WHETHER BASED ON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT OR OTHER LEGAL OR EQUITABLE THEORY, EVEN IF FRBNY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR LOSS AND REGARDLESS OF WHETHER SUCH DAMAGES OR LOSS IS FORESEEABLE.