How to estimate negative impulses & responses for a Bayesian VAR using 'impulse.m' code available in Matlab toolbox

7 views (last 30 days)
Hi,
I am using Gary Koop's (2010) code (<http://personal.strath.ac.uk/gary.koop/bayes_matlab_code_by_koop_and_korobilis.html>) to estimate a Bayesian VAR and I am trying to pull the IRFs for a 1 std dev shock in the innovations using the 'impulse.m' code available in the Matlab toolbox. At this point, I have managed to obtain good results with the code, not changing anything:
response=impulse(By,smat,nstep)
[neq,nvar,nlag]=size(By);
response=zeros(nvar,neq,nstep);
response(:,:,1)=smat';
for it=2:nstep
for ilag=1:min(nlag,it-1)
response(:,:,it)=response(:,:,it)+By(:,:,ilag)*response(:,:,it-ilag); %(1)
Where neq = nr of equations of the VAR nvar = nr of variables nstep = nr of lags of the VAR smat = choleski decomposition of the variance-covariance matrix (transposed so as to get the lower triangular side)
The way the code is specified is that shocks are computed the following way:
shock = chol(SIGMA)';
d = diag(diag(shock));
shock = inv(d)*shock
Where SIGMA is the variance-covariance matrix. Based on the above results, when running the program I am receiving the IRFs for a raise with +1 std dev in the innovations for the specified forecast horizon. I am trying to see the responses for a -1 std dev shock for the same specified horizon although I am not sure how should I change the code to get the clear results.
My first guess was to replace (1) with:
response(:,:,it)=response(:,:,it)-By(:,:,ilag)*response(:,:,it-ilag);
but it did not work.

Answers (1)

Uriel Braham
Uriel Braham on 23 Apr 2018
Hi, hopefully you will receive this. Since the VARs are linear models you can reverse the sign of the shock by just multiplying the whole IRFs with -1.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!