by Yingxin LIN
- FAVAR_TWO_STEPS_LYX is the package for a two-step estimation method of the Factor augmented VAR (FAVAR) models, which is based on RATS 10.0 . In the main code, I replicated the empirical results as in Bernanke et al. (2005) ( i.g. Measuring the effects of monetary policy: a factor-augmented vector autoregressive (FAVAR) approach ), some of them are showed as below:
Note: FFR (Federal funds rate) is the proxy variable of Monetary Policy and the only one observable factor in FAVAR model.
- Why I write this package?
Although there has been a opensource MATLAB package for a Bayesian likelihood methods and Gibbs sampling estimation for FAVAR model yet, that is, the FAVAR MATLAB package written by Gary Koop, it has the disadvantages of large time-consuming due to sampling estimation, inflexible result output process and even some bugs. In order to apply FAVAR in my own research, I have written this RATS code package. - Compared with the MATLAB package, some superiorities of FAVAR_TWO_STEPS_LYX are listed as below:
1. Less running time-comsumption.
2. The program only needs to run once to output the impulse response with error band and variance decomposition results of all series in both xdata.xlsx and ydata.xlsx.
3. The result of generalized variance decomposition is available.
4. Almost no bugs.
5. It is simple to modify this RATS package if you want to apply it to your own reaserch. - I also provided a Python code ( i.g. Draw IRF.ipynb ) in the file-list to show the IRF results outputed by RATS package.
Files in package FAVAR_TWO_STEPS_LYX
- Main code.rpf
- verd_lyx.src - get variance matrix of forecast error
- mcgraphirf_lyx.src - get median value and error band of IRF
- kilianbootsetup.src - two-stages boostrap for IRF error band, based on Kilian(1998).
By adjusting the following parameters in Main code.rpf, it is easy to change the purpose of the package:
ny
- Number of Observable Factors.keyvars
- Number of xdata.xlsx series whose IRF and variance decomposition to MP shock you are intrested in.nf
- Number of Latent factors.ndraws
- Number of draws in two-stages boostrap (for error band of IRF).usegirf
- Whether use Generalized variance decomption or not. whenusegirf = 0
, choleky decomposition is used; On the contrary, ifusegirf = 1
, generalized variance decomption will be applied.
Latent factors obtained by PCA should be rotated as below, since "slow-moving" series in xdata by assumption are not affected contemporaneously by FFR.
dec vect[series] PC_new(nf)
dofor i_ = 1 to nf
linreg(NOPRINT) PC(i_) /
# constant fyff PC_slow(1) to PC_slow(nf)
set PC_new(i_) = PC(i_){0} - %BETA(2) * fyff{0}
end dofor i_
- FAVAR model: Windows RATS 10.0
- Graph for IRF: Python 3.8
File | # of series | Details |
---|---|---|
ydata.xlsx | 1 | The proxy variable of monetary policy, that is, the only one observable factor in FAVAR model |
xdata.xlsx | 119 | Macroeconomic data sets, containing information on real-output, employment, interest rate, exchange rate, price level and financial asset price, etc. |
Data source: Measuring the effects of monetary policy: a factor-augmented vector autoregressive (FAVAR) approach
- The result of IRF with error bands : IRF_FAVAR.xlsx
- The result of variance decomposition : VD_FAVAR.xlsx
- When running the Main code.rpf, all the other files which is also ziped in FAVAR_TWO_STEPS_LYX should be in the same working directory with it, as well as ydata.xlsx and xdata.xlsx.
- For more technical details about two-step estimation method of FAVAR model and my package, it's beneficial to read the working-paper version of Bernanke et al. (2005), which was published in 2004.
- AUTHOR: Yingxin LIN
- Company: Prof.FANG Yi's workshop, School of Finance, Central University of Finance and Economics (CUFE)
- Contact: lyxurthebest@163.com or lyxurthebest@outlook.com
- The copyright belongs to Yingxin LIN , 2021/08/12.