Page 1 of 2

About historical decomposition

Posted: Thu Aug 04, 2011 12:03 pm
by YWZHENG
to every teacher:
i'm a beginner,and i had not known about historical decomposition,such an example of 10.5 in rats 7.0 User's Guide.What does three lines stand for each other?
Second,the attachment is a paper about pass-through exchange historical decomposition,i don't konw how caculate the numbers of "historical decompositiono of CPI" and so on. thank you

Re: About historical decomposition

Posted: Thu Aug 04, 2011 12:59 pm
by moderator
YWZHENG wrote:such an example of 10.5 in rats 7.0 User's Guide.What does three lines stand for each other?
Sorry, I'm not sure what you are asking. Can you explain your question in more detail?

Thanks,
Tom Maycock
Estima

Re: About historical decomposition

Posted: Thu Aug 04, 2011 6:53 pm
by YWZHENG
an content of 10.7 in rats 7.0 User's Guide. page 372 .
the gragh show the effect of interest rate on canadian GDP
What does three lines stand for each other?

Re: About historical decomposition

Posted: Thu Aug 04, 2011 7:38 pm
by YWZHENG
and how caculate the historical decomposition of CPI in page 20 of pass-through exchange.pdf.
thank you

Re: About historical decomposition

Posted: Fri Aug 05, 2011 9:14 am
by moderator
With respect to your question, I believe this is largely explained in the text above the question, and becomes more obvious if you just run the entire example. The solid line is the actual GDP. The dotted line is the base forecast. The dashed line is the effect of (in this case) the interest rate shock.

Regards,
Tom Maycock
Estima

Re: About historical decomposition

Posted: Fri Aug 05, 2011 9:49 am
by TomDoan
YWZHENG wrote:and how caculate the historical decomposition of CPI in page 20 of pass-through exchange.pdf.
thank you
The table would appear to be a decomposition of the change in the import price between 1995:4 and 1998:4. Given data through 1995:4, the projected change in U.S. import prices is .7, the actual change was -3.8. The difference between the two (-4.4 as they did the calculations) can be written as the sum of the cumulated effects of the six shocks during the period 1996:1 to 1998:4. The authors are grouping those six shocks into three sets of two, so the sums of the pairs are the left three columns.

The example in the RATS UG uses the ADD option, which is useful for graphing. For doing the calculation in the paper, it's better to use HISTORY without ADD. For the model in the UG, that would be:

history(model=canmodel,results=history,from=hstart,to=hend)

For variable J in the model (whose actual values are in series Y), and for any time period T+h (where T is the base period for the forecasts), the HISTORY series will satisfy (by construction)

HISTORY(1,J)(T+h)+HISTORY(2,J)(T+h)+...+HISTORY(7,J)(T+h)=Y(T+h)

The calculation in the paper subtracts the base observed value Y(T) from both sides to give:

(HISTORY(1,J)(T+h)-Y(T))+HISTORY(2,J)(T+h)+...+HISTORY(7,J)(T+h)=Y(T+h)-Y(T)

The first term on the left is the forecast changed; the right side is the actual change. The other summands on the left are grouped by twos and added together.

Re: About historical decomposition

Posted: Mon Aug 08, 2011 11:27 pm
by YWZHENG
thank you for moderator and TomDoan. I'm sorry for my behavior.
I have some qustions about historical decompostion need your help.
First,in page 372 of rats 7.0 UG,what's the relationship between each other? The solid line( actual GDP)= the base forecast(dotted line)+the effect of (in this case) the interest rate shock(The dashed line)? but the values of those are nearly.
Second,After I run the history.prg, I click the "data menu","show series window" and will show the list of series including history(1,1),history(2,1)and so on.What does they mean? history(1,1)is the base forecast,and the history(2,1)is the first shock? the values of history(j,1)are nearly.j=1,2,3,4,5,6.
Third,how caculate the catual GDP(in this case),base forecast and each shock by rats program such as pass-through exchange.pdf? I don't understand.

Thank you

Re: About historical decomposition

Posted: Tue Aug 09, 2011 8:23 am
by TomDoan
YWZHENG wrote:thank you for moderator and TomDoan. I'm sorry for my behavior.
I have some qustions about historical decompostion need your help.
First,in page 372 of rats 7.0 UG,what's the relationship between each other? The solid line( actual GDP)= the base forecast(dotted line)+the effect of (in this case) the interest rate shock(The dashed line)? but the values of those are nearly.
As described in the long post above, the actual is the sum of the forecast plus the accumulated effects of all six shocks. The dashed line is the forecast plus the accumulated effect of just the interest rate shock. Because the effects of any of the shocks can be both positive and negative, it's possible for one shock to account for more than 100% of the difference between actual and forecast.
YWZHENG wrote: Second,After I run the history.prg, I click the "data menu","show series window" and will show the list of series including history(1,1),history(2,1)and so on.What does they mean? history(1,1)is the base forecast,and the history(2,1)is the first shock? the values of history(j,1)are nearly.j=1,2,3,4,5,6.
HISTORY(1,1) is the forecast for the first series; HISTORY(2,1) is the accumulated effect of the first shock to the first series, ... , HISTORY(N+1,1) is the accumulated effect of shock N to the first series.
YWZHENG wrote: Third,how caculate the catual GDP(in this case),base forecast and each shock by rats program such as pass-through exchange.pdf? I don't understand.
I believe I explained that in detail before.

Re: About historical decomposition

Posted: Sat Aug 13, 2011 7:15 am
by YWZHENG
TomDoan,thanks you.I'm beginner about historical decomposition.There are my comprehensions about your instruction,please point out the mistakes for correction.


as you described in post above,HISTORY(1,1) is the forecast for the first series; HISTORY(2,1) is the accumulated effect of the first shock to the first series, ... , HISTORY(N+1,1) is the accumulated effect of shock N to the first series.

First, as described in post above, the acual values of valiable j =HISTORY(1,j)+HISTORY(2,j)+...+HISTORY(7,j)=Y(T+h) ? j=1,2,3,4,5,6 (the are total 6 valiables)
++++++and HISTORY(1,1) is the forecast for the first series(is the base foecast of GDP of example of US or project as table 7 of pass-through exchange.pdf)?
++++I can find the the value of HISTORY(1,J) but not the HISTORY(1,J)(T+h) in winrats(history.prg),are there equal ?
++++and what's the Y(T) ? in case of pass-throughe exchange, Y(T)is the value of data of 1995:4 or 2003:1 in history.prg (US) ?

Second, As described in the long post above, the actual is the sum of the forecast plus the accumulated effects of all six shocks.The dotted line is forecast plus the accumulated effect of just the interest rate shock.
My question is : the actual abstract forecase (The dotted line)is other five shocks to first valiable ? "the actual is the sum of the forecast plus the accumulated effects of all six shocks" is the same as " the actual the forecast plus the accumulated effects of all six shocks "?

Third, The moderator considered that "The solid line is the actual GDP. The dotted line is the base forecast. The dashed line is the effect of (in this case) the interest rate shock" is different from yours.What' your opinion about the dashed line ?
How should I understand about " We can see the almost the entirely difference bewteen actual GDP(the solid line) and base forsecast can be contribuated to the interest rate shocks " as described on the page of 372 of the winrats 7.0 UG by graph ?

Thank you very much

Re: About historical decomposition

Posted: Sat Aug 13, 2011 8:26 am
by YWZHENG
As you decribed above, HISTORY(1,1) is the forecast for the first series; HISTORY(2,1) is the accumulated effect of the first shock to the first series, ... , HISTORY(N+1,1) is the accumulated effect of shock N to the first series.

But I find that the average value of HISTORY(1,1)=(forecast for the first series) and all of the HISTORY(N+1,1) are about 14 in history.prg in winrats 7.0.
I think there should be noticeable difference between HISTORY(1,1) and HISTORY(N+1,1),so as HISTORY(N+1,1) each other,but there are nearly. I think thre are maybe misunderstanding.

HISTORY(1,J)(T+h)+HISTORY(2,J)(T+h)+...+HISTORY(7,J)(T+h)= 7*14= ? = Y(T+h)

Re: About historical decomposition

Posted: Sat Aug 13, 2011 9:08 am
by TomDoan
YWZHENG wrote: Third, The moderator considered that "The solid line is the actual GDP. The dotted line is the base forecast. The dashed line is the effect of (in this case) the interest rate shock" is different from yours.What' your opinion about the dashed line ?
How should I understand about " We can see the almost the entirely difference bewteen actual GDP(the solid line) and base forsecast can be contribuated to the interest rate shocks " as described on the page of 372 of the winrats 7.0 UG by graph ?

Thank you very much
I used dotted where I meant dashed (which I've now corrected).

Re: About historical decomposition

Posted: Sat Aug 13, 2011 10:26 am
by TomDoan
YWZHENG wrote:As you decribed above, HISTORY(1,1) is the forecast for the first series; HISTORY(2,1) is the accumulated effect of the first shock to the first series, ... , HISTORY(N+1,1) is the accumulated effect of shock N to the first series.

But I find that the average value of HISTORY(1,1)=(forecast for the first series) and all of the HISTORY(N+1,1) are about 14 in history.prg in winrats 7.0.
I think there should be noticeable difference between HISTORY(1,1) and HISTORY(N+1,1),so as HISTORY(N+1,1) each other,but there are nearly. I think thre are maybe misunderstanding.

HISTORY(1,J)(T+h)+HISTORY(2,J)(T+h)+...+HISTORY(7,J)(T+h)= 7*14= ? = Y(T+h)
As I said above, the example in the RATS manual uses the ADD option which adds the base forecast to all the shock effects. That makes it easier to use in the types of graphs in the manual, but they no longer satisfy the identity since the base forecast would be in the sum seven times.

If you're having trouble understanding this, I would suggest that you take a much smaller model, do HISTORY without the ADD option, and play with the numbers a bit. I just posted to the forum the replication for the Quah-Vahey EJ 1995 paper (http://www.estima.com/forum/viewtopic.php?f=8&t=1156) where the main calculation is an example of historical decomposition. There's also a forum post which includes a link to a more complete description of historical decomposion and related topics: http://www.estima.com/forum/viewtopic.php?f=4&t=655

Re: About historical decomposition

Posted: Sat Aug 13, 2011 10:06 pm
by YWZHENG
Thank you very much. Your meaning is that the formula will be identified if substract ADD option ? I try it and find the values of history(N+1,1)be changed largerly.
and the example of winrats 7.0 US (on the pages of 372) decribed solid line is actural(GDP) ,the dotted line is forecast(GDP) and the dashed line is the forecast plus first shock to GDP ?

It's so kind of you

Re: About historical decomposition

Posted: Wed Aug 17, 2011 2:46 am
by WALLE
Hello,

I am estimating a 6 variable VAR and I was interested in carrying out the historical decomposition procedure. Upon reading the user guide. I came up with the following procedure after setting up and estimating the VAR.

Code: Select all

***************************************************************
*SET UP/ESTIMATE VAR SYSTEM
***************************************************************
compute neqn = 6
compute nlags = 2
compute nsteps = 12
compute ndraws = 10000

system(model=canvar)
variables OILP CAN_CPI_INF CAN_GDEF_INF CAN_WAG_INF CAN_OUTPUT CAN_UR
lags 1 to nlags
det constant
end(system)

estimate(noprint,resids=varresidscan)

**********************************************************************
*HISTORICAL DECOMPOSITION
**********************************************************************
compute hstart = 1970:01
compute hend  = 2010:04
compute modelsize=%modelsize(canvar)
dec vect[int] depvar(modelsize)
dec vect[labels] varlabels(modelsize)
ewise varlabels(i)=%modellabel(canvar,i)
compute depvar=%modeldepvars(canvar)
*
estimate(noprint,noftests,resids=resids)
history(model=canvar,add,results=history,from=hstart,to=hend)

do j=1,6
   spgraph(hfields=2,vfields=3,window=varlabels(j),$
     header="Historical Decomposition of "+varlabels(j))
   do i=1,6
      graph(header="Effect of "+varlabels(i)) 3
      # depvar(j) hstart-4 hend
      # history(1,j)
      # history(1+i,j)
   end do j
   spgraph(done)
The problem I have upon obtaining the output is I would like to obtain the effect of shocks in one variable in the variations in other variables as a standalone as opposed to the present output which is the historical decomposition of all the series to one another. Put simply I want to isolate the historical decomposition of a shock to one variable in all the others. In my case that of an oil shock on all the other series.

Thanks

Re: About historical decomposition

Posted: Wed Aug 17, 2011 7:40 am
by TomDoan
WALLE wrote:Hello,

I am estimating a 6 variable VAR and I was interested in carrying out the historical decomposition procedure. Upon reading the user guide. I came up with the following procedure after setting up and estimating the VAR.

Code: Select all

***************************************************************
*SET UP/ESTIMATE VAR SYSTEM
***************************************************************
compute neqn = 6
compute nlags = 2
compute nsteps = 12
compute ndraws = 10000

system(model=canvar)
variables OILP CAN_CPI_INF CAN_GDEF_INF CAN_WAG_INF CAN_OUTPUT CAN_UR
lags 1 to nlags
det constant
end(system)

estimate(noprint,resids=varresidscan)

**********************************************************************
*HISTORICAL DECOMPOSITION
**********************************************************************
compute hstart = 1970:01
compute hend  = 2010:04
compute modelsize=%modelsize(canvar)
dec vect[int] depvar(modelsize)
dec vect[labels] varlabels(modelsize)
ewise varlabels(i)=%modellabel(canvar,i)
compute depvar=%modeldepvars(canvar)
*
estimate(noprint,noftests,resids=resids)
history(model=canvar,add,results=history,from=hstart,to=hend)

do j=1,6
   spgraph(hfields=2,vfields=3,window=varlabels(j),$
     header="Historical Decomposition of "+varlabels(j))
   do i=1,6
      graph(header="Effect of "+varlabels(i)) 3
      # depvar(j) hstart-4 hend
      # history(1,j)
      # history(1+i,j)
   end do j
   spgraph(done)
The problem I have upon obtaining the output is I would like to obtain the effect of shocks in one variable in the variations in other variables as a standalone as opposed to the present output which is the historical decomposition of all the series to one another. Put simply I want to isolate the historical decomposition of a shock to one variable in all the others. In my case that of an oil shock on all the other series.

Thanks
This reverses the order of the nested loops at the end so the graphs are grouped by shock rather than by target variable. If you want just one set of shocks, you can run the outer do over just one value (such as do i=3,3)

Code: Select all

do i=1,6
   spgraph(hfields=2,vfields=3,window=varlabels(i),$
	   header="Effect of "+varlabels(i))
   do j=1,6
      graph(header=varlabels(j)) 3
      # depvar(j) hstart-4 hend
      # history(1,j)
      # history(1+i,j)
   end do j
   spgraph(done)
end do i