Matlab Library

[ZIP] My Matlab library contains common Matlab functions used by my other programs. Before using other programs, first download the library and then add a Matlab path to all the library files (including those in subdirectories).

Data for China’s Macroeconomy

[LINKS] The time series dataset for the NBER Macroeconomics Annual 2016 paper “Trends and Cycles in China’s Macroeconomy” by Chang, Chen, Waggoner, and Zha and the manuscript China’s Macroeconomic Time Series: Methods and Implications by Higgins and Zha. Please consult readme_data for instructions of how to use this dataset. For the April 2015 vintage dataset, it can be downloaded at the NBER website. For an updated and expanded dataset, you can download it at the CQER website of the Federal Reserve Bank of Atlanta. 

 
Computer Code

[ZIP] Matlab code for the forthcoming American Economic Review article “The Nexus of Monetary Policy and Shadow Banking in China” along with readme files: 

    1. The panel SVAR can be downloaded from PanelSVAR

    2. Estimation of the switching monetary policy rule and exogenous monetary policy shocks can be downloaded from the zip file MatlabCodeEstMP_tv.

     3. Time series of estimated exogenous monetary policy shocks can be downloaded from the Excel/csv format data2016Q2mpshocks.csv or from the Matlab format data2016Q2mpshocks.mat.

[ZIP] The estimation of the DSGE model for the 2016 Journal of Monetary Economics paper “Land Prices and Unemployment” is executed with the C code SourceC4JME.zip, which calls the master C library CLibraryMaster.zip.  The BVAR impulse responses are computed with the Matlab code BVAR4JME.zip.  

[ZIP] The Mathematica code DSGE_Perturb_Code.zip for the 2016 Quantitative Economics paper “Perturbation Methods for Markov-Switching DSGE Models.” 

[ZIP] The C/C++ and Dynare 4.2 code for the 2013 Econometrica paper “Land-Price Dynamics and Macroeconomic Fluctuations.”  For the C/C++code, click on C_Cpp_Library4LWZpaper.zip and C_Cpp_Code4LWZpaper.zip.  For the Dynare 4.2 code, click on DynareCode4LWZpaper.zip.  The most recent C/C++ code should be downloaded by clicking on PublicCodeECMA_LWZ.zip

[ASCII] The RWZ algorithm SRestrictRWZalg.m for implementing VAR sign restrictions of Canova, Faust, and Uhlig. The zipped file RWZrestrictions_FiscalPolicy.zip shows an empirical example of sign restrictions applied to identifying fiscal policy shocks. This new algorithm proves very efficient as compared to the existing algorithms and is coded up in Matlab. The algorithm is described in detail in the 2010 (April) Review of Economic Studies paper “Structural Vector Autoregressions: Theory of Identification and Algorithms for Inference.” 

[ZIP] The Matlab code, fwzmsv_nk_example.zip (8KB), for the new-Keynesian example in the Journal of Economic and Dynamic Control paper “Minimal State Variable Solutions to Markov-switching Rational Expectations Models.” 

[ZIP] The Matlab code for Conditional Forecasts in Dynamic Multivariate Models (Review of Economics and Statistics 1999). Click on Cfprob.zip  (80KB) to download.

[ZIP] The Matlab code,  GeneratingPriors.zip (6KB), for generating Normal, Beta, Gamma, and Inverse Gamma priors in the 2011 (2) Quantitative Economics paper Sources of Macroeconomic Fluctuations: A Regime-Switching DSGE Approach.”   The file get_hyperpars2.m backs out the hyperp arameter values of the prior density to meet the specified probability interval with low and high values.   You need 4 inputs: the low value, the cumulative probability at this low value, the high value, and the cumulative probability at this high value.  In general, these probabilities are specified at 0.05 and 0.95.  The zip file GeneratingPriors.zip contains other useful M files (see the readme_priors.prn file). 

[ZIP] The Matlab code, LWZ_RED_PublicCode.zip, for the Review of Economic Dynamics paper “Asymmetric Expectation Effects of Regime Switches in Monetary Policy.” Read the file readme_lwzmodel.txt for instructions of how to use this program.

[ZIP] The Matlab and C program, PublicCode_swzestimate.zip (4.8MB), for the Journal of Econometrics paper “Methods for Inference in Large Multiple-Equation Markov-Switching Models.” Read the file Instructions_swz_estimate.prn for instructions of how to use this program.  The executable files swzmsbvario.exe and swzestimate.exe are for Windows; the executable files swzmsbvario and swzestimate for Linux.   If you wish to compile and link the C source files yourself, click on TZCcode.zip (562KB) to download the source code.  You need a modern C++ complier, Intel MKL, and IMSL C library to compile.  For compilation questions under the Windows or Linux operating system, please write to Eric Wang at Keyun.Wang@atl.frb.org.   

[ZIP] The Matlab code for structural VARs with linear over-identified restrictions on both current and lagged coefficients discussed in Cushman and Zha (1997) and Zha (1999).  This example, motivated by Dhawan and Jeske’s DSGE model, uses the four variables: energy prices, durable investment, capital investment, and output.  It is assumed that energy prices follow an exogenous autoregressive process.  The code performs the three common tasks:  (1) estimates the model parameters and impulse responses with or without the standard Bayesian prior, (2) computes the error bands for impulse responses, and (3) computes the marginal likelihood or data density.  Click on readme_restrictedVAR.zip (34KB) to download the core files.  Consult the file readme_mdd.prn for detailed explanations and instructions. 

[ASCII] The C source code for Shocks and Government Beliefs: The Rise and Fall of American Inflation. To download this program, click on the files modeleconomy.cmodeleconomy.hswz_comfuns.cswz_comfuns.h, and probconst.c.

[ZIP] The Matlab code ReducedFormBVAR.zip (9KB) for unconditional forecasts from a reduced-form Bayesian Vector Autoregressive (BVAR) model with the Sims and Zha prior.

[ZIP] The Matlab code for estimating the Bayesian Vector Autoregressive (BVAR) models, just-identified and over-identified, with the Sims and Zha (IER, 1998)’s prior.   Read the Word file Readme_BVAR.doc to see the instruction of how to use this code and click on AlphaModel_Files.zip (1.1MB) to download. The code was originally written by Zha and is extensively modified by Andy Bauer, a senior economic analyst, at the Federal Reserve Bank of Atlanta.  The article by Robertson and Tallman is particularly useful for understanding the prior as well as various features of the model (e.g., the out-of-sample forecasts from this kind of BVAR model is insensitive to whether the data are of real time nature or in final revised form).

[ZIP] The Matlab code for computing the marginal likelihood or data density for structural BVAR models (including overidentified cases).  Click on swz_mardd.zip (23KB) to download.  Read the file readme_mdd.prn to see the instructions of how to use this code.

[ZIP] The Matlab code for a Gibbs sampler for just-identified and overidentified BVARs.  To download it, click on GibbsVar.zip (129KB).

[ZIP] The Matlab sample code that uses the Waggoner-Zha Gibbs (and optionally Metropolis) sampler, Waggoner-Zha normalization, and optionally the Sims-Zha prior.  To see an example of using this code, click on example.zip (97KB).

[ZIP] The Matlab code for Error Bands for Impulse Responses by Sims and Zha (Econometrica 1999). To download it, click on EconometricaSimsZha1999.zip (482KB) and SimpleModel_ClassicalBootstrap.zip (438KB).

[ZIP] The Matlab code for Block Recursion and Structural Vector Autoregressions (Journal of Econometrics 1999). To download it, click on Blkwk.zip (26KB), meg.zip (6KB), TZBlk.zip (22KB), and Xd12.zip (11KB).

[ZIP] The Matlab code for Identifying Monetary Policy in a Small Open Economy under Flexible Exchange Rates by Cushman and Zha (Journal of Monetary Economics 1997). To download it, click on CushmanZha_JME.zip (943KB) and fig2.zip (203KB).