contributions to an annual growth rate
[list_contrib_a_unb,list_contrib_a_bal,list_conttrim,mainf]=contrib_logq2gra(namey,arg1,...,argn)
* namey = a string representing the name of a ts
* arg1,...,argn =
- a list of 3 elements:
. the name of the variable whose contribution is to be calculated
. the Autoregressive part of the equation
.the Moving Average part relative to the considered variable
- the string 'prt=xxx' where xxx can be:
.'trim' if the user wants the quarterly contributions to be printed
. 'mainf' if the user wants the Infinite Moving Average approximation to be printed
. 'unbal' if the user wants the annual contributions before rebalancing to be printed
. 'cont' if the user wants the annual contributions after rebalancing to be printed
.' all' if the user wants all these results to be printed
* list_contrib_a_unb = list of the unbalanced yearly contributions
* list_contrib_a_bal = list of the balanced yearly contributions
* list_conttrim = list of the quarterly contributions
* mainf = the matrix of infinite moving averages
load(GROCERDIR+'/data/bdhenderic.dat') ; m1=exp(lm1) // set the estimation bounds bounds('1964q3','1989q2') // estimate the model by ols and save the results in the tlist // rols; names are entered between quotes, in order that their // names appears on the printed results rols=ols('delts(lm1-lp)','delts(lp)','delts(lagts(1,lm1-lp-ly))','rnet'... ,'lagts(1,lm1-lp-ly)','cte') // retrieve the coeficients of the regression coef=rols('beta') // calculate the residual over the whole period resid=delts(lm1-lp)-coef(1)*delts(lp)-coef(2)*delts(lagts(1,lm1-lp-ly))-coef(3)*rnet... -coef(4)*lagts(1,lm1-lp-ly)-coef(5) bounds() ; // calculate the ma infinite approximations mainf_lp=mainf([1+coef(2)+coef(4) ; -coef(2)],[1+coef(1) ; -1-coef(1)-coef(2)-coef(4) ; coef(2) ],200) mainf_ly=mainf([1+coef(2)+coef(4) ; -coef(2)],[0 ; -coef(2)-coef(4) ; coef(2) ],200) mainf_resid=mainf([1+coef(2)+coef(4) ; -coef(2)],1,200) mainf_rnet=coef(3)*mainf_resid // calculate the contributions contrib_lp=contrib(delts(lp),mainf_lp) contrib_ly=contrib(delts(ly),mainf_ly) contrib_resid=contrib(delts(resid),mainf_resid) contrib_rnet=contrib(delts(rnet),mainf_rnet) // now calculates annual growthr contributions he_lp_list=list('lp',[1+coef(2)+coef(4) ; -coef(2)],[1+coef(1) ; -1-coef(1)-coef(2)-coef(4) ; coef(2) ]) he_ly_list=list('ly',[1+coef(2)+coef(4) ; -coef(2)],[0 ; -coef(2)-coef(4) ; coef(2) ]) he_rnet_list=list('rnet',[1+coef(2)+coef(4) ; -coef(2)],coef(3)) he_resid_list=list('resid',[1+coef(2)+coef(4) ; -coef(2)],1) [listcont_unbal,listcont_bal]=contrib_logq2gra('m1',he_lp_list,he_ly_list,he_rnet_list,he_resid_list,'prt=all') | ![]() | ![]() |