Page 1 of 2
Sign restriction - Historical Decomposition
Posted: Thu Jun 25, 2009 11:30 am
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.
Re: Sign restriction - Historical Decomposition
Posted: Mon Sep 28, 2009 3:26 pm
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
Re: Sign restriction - Historical Decomposition
Posted: Tue Sep 29, 2009 7:19 am
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.
Re: Sign restriction - Historical Decomposition
Posted: Tue Sep 29, 2009 9:01 am
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
Re: Sign restriction - Historical Decomposition
Posted: Fri Oct 23, 2009 5:24 pm
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
Re: Sign restriction - Historical Decomposition
Posted: Mon Oct 26, 2009 11:21 am
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.
Re: Sign restriction - Historical Decomposition
Posted: Tue Oct 27, 2009 10:45 am
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
Re: Sign restriction - Historical Decomposition
Posted: Wed Feb 17, 2010 11:31 pm
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
Re: Sign restriction - Historical Decomposition
Posted: Thu Feb 18, 2010 10:49 am
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.
Re: Sign restriction - Historical Decomposition
Posted: Thu Feb 18, 2010 11:13 am
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.
Re: Sign restriction - Historical Decomposition
Posted: Tue Jul 15, 2014 10:09 am
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>>?
Re: Sign restriction - Historical Decomposition
Posted: Tue Jul 15, 2014 2:01 pm
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.
MAT13 error during plotting
Posted: Wed Oct 22, 2014 10:08 am
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!
Re: Sign restriction - Historical Decomposition
Posted: Wed Oct 22, 2014 10:29 am
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.
Re: Sign restriction - Historical Decomposition
Posted: Wed Oct 22, 2014 12:20 pm
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!