Placing dates on the horizontal axis of historical shock decomposition shocks

Hello everyone,
I read at Placing dates on the horizontal axis of shock decomposition

the discussion on how to place dates on the vertical axis of the historical decomposition graph of shocks using an .m file. Please, how can I do the same thing using an excel file? I tried following the steps at tests/dates/fs2000.mod · master · Dynare / dynare · GitLab, but I was not successful.

Using an excel file, should the estimation command also suppress the name of the xls file? And how to do with the name of the observable series that usually are in the first line?

I am attaching my xls file, with data between 2000Q1 and 2018Q3, using 6 observable series.

Thank you.
brdatach1new.xls (35 KB)

@stepan-a How would this work with dseries?

Hi Stepan. Could you help me? Best

Hi,

I am not sure I understand what you intend to do… I believe all this is explained in the reference manual. From the Matlab command window you can put your data in a dseries object:

>>  ds = dseries('brdatach1new.xls', '2000Q1');

You can check by displaying the object:


 
ds is a dseries object:
 
       | dy_obs   | pi_obs  | i_obs  | i360_obs | i720_obs | i1800_obs
2000Q1 | 1.3287   | 0.65917 | 4.3245 | 4.9012   | 5.1491   | 4.8944   
2000Q2 | 0.31327  | 1.1031  | 4.1525 | 4.934    | 5.0239   | 5.1862   
2000Q3 | 1.0049   | 3.3771  | 3.9094 | 4.2826   | 4.3771   | 4.6066   
2000Q4 | 0.94181  | 0.51526 | 3.683  | 4.3122   | 4.414    | 4.6622   
2001Q1 | -0.61854 | 1.2252  | 3.5184 | 4.0779   | 4.1872   | 4.4164   
2001Q2 | -0.4199  | 2.094   | 3.7728 | 5.3174   | 5.5233   | 5.8233   
2001Q3 | -0.76334 | 2.4898  | 4.3896 | 6.1832   | 6.8706   | 7.8762   
2001Q4 | -0.70914 | 1.5323  | 4.291  | 5.5782   | 6.2411   | 7.4405   
2002Q1 | 1.5443   | 1.2849  | 4.1248 | 4.7224   | 5.1964   | 6.0845   
2002Q2 | 0.8277   | 2.0664  | 4.198  | 5.2402   | 5.928    | 6.8748   
       |          |         |        |          |          |          
2016Q1 | -1.1644  | 1.9566  | 3.2035 | 3.5514   | 3.6534   | 3.7899   
2016Q2 | -0.52813 | 1.787   | 3.3086 | 3.2612   | 3.145    | 3.136    
2016Q3 | -0.34064 | 1.7273  | 3.4136 | 3.2114   | 3.0246   | 2.9542   
2016Q4 | -1.1574  | 0.62921 | 3.1934 | 3.0003   | 2.8502   | 2.8746   
2017Q1 | 0.68079  | 0.32613 | 2.9882 | 2.5845   | 2.4943   | 2.5976   
2017Q2 | 0.068929 | 0.2717  | 2.512  | 2.279    | 2.3469   | 2.576    
2017Q3 | -0.1836  | 1.279   | 2.2303 | 1.9433   | 2.0905   | 2.424    
2017Q4 | -0.15551 | 1.0279  | 1.7454 | 1.7472   | 2.0228   | 2.4486   
2018Q1 | 0.40736  | 0.06673 | 1.578  | 1.6869   | 1.9654   | 2.3588   
2018Q2 | 0.33216  | 1.9236  | 1.5509 | 1.7299   | 1.9847   | 2.4988   
2018Q3 | -0.15349 | 1.4079  | 1.5755 | 1.9306   | 2.2272   | 2.7502   

Then you just have to call the plot function (overloaded for dseries objects):

>>  plot(ds.dy_obs)

which will add periods on the abscissa:

Best,
Stéphane.

1 Like

Hi Stepan, thank you very much for your attention.
In fact, I ask for your help to place the dates on the graph of historical decomposition of shocks and not to chart the observed series.
In this forum, there are tips on how to do this by having a matlab file. In my case, I have an excel file.
Best,

Hi,

Then it’s almost the same approach. It is possible to instantiate a dseries from a matlab array instead of a data file. The sole difference is that you have to provide the names of the series in a third argument to the dseries constructor (routine) as a cell of char arrays, you can also provide the \TeX names of the variables in a fourth argument. In the array, passed as the first argument, the data must be in column (each column is for a different variable). The data you need are stored in oo_.shock_decomposition which is a three dimensional array which you’ll have to manipulate (transposition, squeeze, …) to fit your needs. The organisation of this array is described in the reference manual. The different approaches to instantiate dseries objects are also described in section 6.2 of the same manual.

Best,
Stéphane.