Sign restriction - Historical Decomposition

Questions and discussions on Vector Autoregressions
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Sign restriction - Historical Decomposition

Unread post by TomDoan »

The Uhlig JME replication example has been extended to include calculation of the historical decomposition. Updated 22 October 2014 to provide a warning if the number of accepted draws is less than the number requested.
charbel
Posts: 4
Joined: Mon Oct 08, 2007 3:35 am

Re: Sign restriction - Historical Decomposition

Unread post by charbel »

Dear Tom,
Is it possible with the code that you posted to decompose the variance of forecast error of the variables in the model based on the historical decompossition?
Thanks,
Charbel
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Sign restriction - Historical Decomposition

Unread post by TomDoan »

Dear Tom,
Is it possible with the code that you posted to decompose the variance of forecast error of the variables in the model based on the historical decompossition?
Thanks,
Charbel
I'm not sure what you mean.
charbel
Posts: 4
Joined: Mon Oct 08, 2007 3:35 am

Re: Sign restriction - Historical Decomposition

Unread post by charbel »

By impulse responses or FEVD we can analyze only the overall effects of a shock. In contrast by the historical decomposition, we can analyze the role of the shock in question in a specific period. I would like to decompose the forecast error variance of a particular variable in each sub-period based on the historical decomposition.This could be done by calculating the ratio of the averaged square of the contribution of each structural shock to the averaged square of forecast error of the variable in question.We base this calculation on the historical decomposition rather on impulse responses.
In the usual variance decompostion, structural shocks are uncorrelated, this means that the variance of forecast errors is equal to the sum of the contribution of each structural shock. However, even though the structural shocks for the whole period are orthogonal, they can be mutually correlated in a specific period. In this decomposition, not only the contribution of each structural shock, but also the contribution of the cross terms among structural shocks must be considered. All these contribution are summed up in the forecast error variance of the decomposed series. This idea is pointed by Kim, S. Journal of international economics (48) 1999, 387-412
charbel
Posts: 4
Joined: Mon Oct 08, 2007 3:35 am

Re: Sign restriction - Historical Decomposition

Unread post by charbel »

Dear RAts users,
I have one more question concerning the historical decomposition.
Are the total effect of all the shocks and the contributions of each shock given respectively by base and baseplus series?
Thanks
Charbel
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Sign restriction - Historical Decomposition

Unread post by TomDoan »

charbel wrote:Dear RAts users,
I have one more question concerning the historical decomposition.
Are the total effect of all the shocks and the contributions of each shock given respectively by base and baseplus series?
Thanks
Charbel
The baseplus series is the base + cumulative effects of one shock. So the difference between baseplus and base is the cumulative effect in isolation. The identity is data(t) = base(t) + sum over i of cum effects of shock i at t.
charbel
Posts: 4
Joined: Mon Oct 08, 2007 3:35 am

Re: Sign restriction - Historical Decomposition

Unread post by charbel »

Hi Tom,
Tanks for your reply. I am sorry for bothering you one more time. I am estimating a three dimensional VAR. I impose sign restrictions on the IRFs as in Uhlig(2005) to identify three shocks: demand shock, supply shock and a monetary shock. I compute the IRFs, the FEVDs and the historical decomposition as it is suggested on the forum. The difference is that I do not consider Bayesian estimation as it suggested in the code you posted and in Uhlig (2005). I am not quite sure from my program because
1-every time I compile the code, the IRFs, the FEVDs and the HDs change. I considered many draws (10000, 15000, 20000, 25000) but nothing changed. Results change with every compilation.
2-If I put the loop to plot the historical decomposition at the end of the code; the latter does not work for some sample (iperiod=2,3,4,5). While if I insert the loop to plot the HD after (end do draws) the code works for all the samples but the results change with every new compilation.
I attach the code and the data in case you have some suggestions.
Thanks, Charbel
Attachments
data m.xls
(215.5 KiB) Downloaded 889 times
uhlig_3shocks2.PRG
(15.44 KiB) Downloaded 1293 times
TL
Posts: 22
Joined: Thu Oct 02, 2008 9:58 am

Re: Sign restriction - Historical Decomposition

Unread post by TL »

Dear Tom,

I have used the above code with uhligdata.xls to calculate the historical decomposition.

I am wondering what the appropriate way in interpreting the value on the y-axis is. In particular, would it be correct to say that it shows contributions of shocks measured as percentage points to deviations from baseline?

Thank you very much for your help and kindness.

Sincerely,

Tim
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Sign restriction - Historical Decomposition

Unread post by TomDoan »

TL wrote:I am wondering what the appropriate way in interpreting the value on the y-axis is. In particular, would it be correct to say that it shows contributions of shocks measured as percentage points to deviations from baseline?
The interpretation is going to depend upon the transformations applied to the series. With the following:

Code: Select all

set gdpc1    = log(gdpc1)*100.0
set gdpdef   = log(gdpdef)*100.0
set cprindex = log(cprindex)*100.0
set totresns = log(totresns)*100.0
set bognonbr = log(bognonbr)*100.0
the interpretation for those five series will be cumulative percentage change from the baseline. If GPDC1 takes the value 4, that means the cumulated effect of the particular shock is to push the level up 4% as of that date.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Sign restriction - Historical Decomposition

Unread post by TomDoan »

charbel wrote: Tanks for your reply. I am sorry for bothering you one more time. I am estimating a three dimensional VAR. I impose sign restrictions on the IRFs as in Uhlig(2005) to identify three shocks: demand shock, supply shock and a monetary shock. I compute the IRFs, the FEVDs and the historical decomposition as it is suggested on the forum. The difference is that I do not consider Bayesian estimation as it suggested in the code you posted and in Uhlig (2005). I am not quite sure from my program because
1-every time I compile the code, the IRFs, the FEVDs and the HDs change. I considered many draws (10000, 15000, 20000, 25000) but nothing changed. Results change with every compilation.
2-If I put the loop to plot the historical decomposition at the end of the code; the latter does not work for some sample (iperiod=2,3,4,5). While if I insert the loop to plot the HD after (end do draws) the code works for all the samples but the results change with every new compilation.
I attach the code and the data in case you have some suggestions.
Thanks, Charbel
When I ran this I got 12 acceptances out of 10000 attempts. I assume that's why you're getting results which change from one set of trials to the next. In effect, your restrictions are close to being mutually incompatible.
jonasdovern
Posts: 97
Joined: Sat Apr 11, 2009 10:30 am

Re: Sign restriction - Historical Decomposition

Unread post by jonasdovern »

Dear RATS users,

I would like to revive this thead.

In the example from the first post of this thread, where can I obtain the sequence of historical structural shocks corresponding to a particular <<a>>? I am a little bit confused because <<u>> seem to be the reduced form residuals and also <<upaths>> seem to be the reduced form residuals that are generated by the monetary policy shocks only.

Would it make any sense to extract a sequence of historical structural shocks based on the average of such sequences over all draws of <<a>>?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Sign restriction - Historical Decomposition

Unread post by TomDoan »

If P is the Cholesky factor, then a*inv(P)*%xt(u,t) will be the structural shocks (it will be just a single series) corresponding to a draw for a.

I would tend to doubt that averaging across draws for a would be particularly interesting. The historical decompositions (which involve averaging the response effects) tend to have very broad ranges.
cordura
Posts: 4
Joined: Mon Sep 22, 2014 7:44 am

MAT13 error during plotting

Unread post by cordura »

Dear Mr. Doan,

I am currently working on the historical decomposition part of Uhlig sign restriction. My code is partially working, except for the historical decomposition part. Everytime it stucks, showing error message:

## MAT13. Store into Out-of-Range Matrix or Series Element
The Error Occurred At Location 278, Line 8 of loop/block

Please enlighten me.

I have two data sets coz I did interpolation for GDP and Loan volume. Wish it does not bother you.

Thanks!
Attachments
data2.xls
(41.5 KiB) Downloaded 727 times
data1.xls
(26 KiB) Downloaded 652 times
histo 5.RPF
(8.05 KiB) Downloaded 1014 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Sign restriction - Historical Decomposition

Unread post by TomDoan »

Replace the DECLARE SERIES upperH ... with

smpl
clear upperH lowerH respH

However, the reason you're getting the problem is you only get somewhere around 20 accepted draws out of 40000 trials. That's not good. I posted a new version above which includes the following (after the infobox(action=remove) instruction):

{
if accept<nkeep
messagebox(style=alert) "Only had "+accept+" accepted draws, not the requested "+nkeep
}

That won't fix the problem that the constraints are almost impossible to meet, but at least make it more obvious when you have a problem.
cordura
Posts: 4
Joined: Mon Sep 22, 2014 7:44 am

Re: Sign restriction - Historical Decomposition

Unread post by cordura »

Dear Mr. Doan,

thank you very much for your reply! I implement the new version of your code. the accepted draws is not satisfying.

I am wondering if you could give me some suggestions how improve my draw issues? Is there anything wrong with my sign restriction or it is data issue?

Thanks a lot!
Post Reply