Page 1 of 1
[share] shock contributions labels and groups
Posted:
Fri Apr 19, 2013 9:46 am
by Vermandel
I run a medium scale model for my thesis with a lot of shocks. I needed to group them to make the shock contribution more clear than the current way it's showed by dynare.
To do so, download attached dynare files and put them in /dynare/matlab/ folder. For instance, when using the Smets & Wouters model given by jpfeifer
viewtopic.php?f=1&t=3750 , adding at the end of the mod file :
- Code: Select all
options_.groups{1}={'ea';'epinf'};
options_.groups{2}={'eg';'eb';'ew'};
options_.groups{3}={'em';'eqs'};
options_.labels = char( 'Supply', 'Demand', 'Monetary' );
shock_decomposition y;
this will aggregate the shocks by the given groups (those given in the example are dummy). if options_.labels is not given, the code will automatically generate some group names.
I wanted to edit dynare argument of the function shock_decomposition(), but i couldnt (dynare was giving me an error). I guess that some important dynare internal functions are declared in dynare.exe, my hex editor told me so (but i cannot edit it, i'm not a C coder).
Re: [share] shock contributions labels and groups
Posted:
Sat Apr 20, 2013 7:57 am
by jpfeifer
First of all, you don't need to deal with C-code. Everything here is done in Matlab. Second, the whole shock decomposition is stored in oo_.shock_decomposition. Thus, you could just use this information for graphing.
Re: [share] shock contributions labels and groups
Posted:
Thu Nov 14, 2013 8:51 pm
by costa
Hi all,
I´m trying to do the same decomposition metioned previously, but I didn´t understand where should I place the part of the code below:
options_.groups{1}={'ea';'epinf'};
options_.groups{2}={'eg';'eb';'ew'};
options_.groups{3}={'em';'eqs'};
options_.labels = char( 'Supply', 'Demand', 'Monetary' );
Is it before or inside the estimation comand ? Or is it inside the shock_decomposition comand ?
I did a research about this in the forum, but I didn´t find the answer.
Thanks for the attention.
Re: [share] shock contributions labels and groups
Posted:
Sat Nov 16, 2013 10:24 am
by federico
before the shock decomposition command
Re: [share] shock contributions labels and groups
Posted:
Sat Nov 16, 2013 10:09 pm
by costa
Hi Frederico,
I know this should be posted in the help part of the forum, but could you take a look and say what is wrong with the part of the code below? I got an "unexpected name" message from dynare, refering to the shock command inside the shock_decompositon command.
options_.groups{1}={'eps_ah';'eps_ys';'eps_sh_i';'eps_sh_w';'eps_ys';};
options_.groups{2}={'eps_sh_c'};
options_.groups{3}={'eps_sh_m'};
options_.groups{4}={'eps_prsF';'eps_yF';'eps_iF';'eps_piF';'eps_prfF';'eps_prfF';'eps_proF'};
options_.labels = char( 'supply', 'demand', 'monetary','external');
stoch_simul(irf=0) y_hat, picz_hat, rer_hat, l_hat, ca_y_hat, i_hat, c_hat, inv_hat;
shock_decomposition(parameter_set = calibration, shocks= (options_.groups{1};options_.groups{2};options_.groups{3};
options_.groups{4}) ,labels= options_.labels)
y_hat, picz_hat, rer_hat, l_hat, ca_y_hat wr_hat c_hat inv_hat pri_hat;
Re: [share] shock contributions labels and groups
Posted:
Mon Nov 18, 2013 9:24 am
by federico
try to move all the label afetr stoch_simul
and simply use the command shock_decomposition without any other option and see if it works.
Besides, I remember i had same troubles in running this options with dynare > 4.3 version.
I succesfully ues it with dynare 4.2.5 .
If it does't work i think you should post your mod file and see what i can do.
Re: [share] shock contributions labels and groups
Posted:
Tue Nov 19, 2013 4:45 pm
by Vermandel
here is attached an example file with Smets & Wouters codes.
Re: [share] shock contributions labels and groups
Posted:
Sun Dec 01, 2013 6:45 pm
by costa
Hi Vermandel and Frederico,
I think this problem is related with the dynare version, because I ran the code above and got the chart without the labels. I´m using dynare 4.3.3. Which version are you using, Vermandel?
Re: [share] shock contributions labels and groups
Posted:
Mon Dec 02, 2013 9:11 am
by federico
It works surely under dynare version 4.2.5
Re: [share] shock contributions labels and groups
Posted:
Sat May 30, 2015 11:15 am
by Oriana
Hi,
I am working with dynare 4.3.3 version.
I got,
Starting Dynare (version 4.3.3).
Starting preprocessing of the model file ...
ERROR: nonlinearomega.mod:1713.48-53: syntax error, unexpected NAME, expecting DATAFILE or LABELS or PARAMETER_SET or SHOCKS
What is unexpected since in nonlinearomega.mod:1713.48-53 I already have SHOCKS ( for confirmation, please, see the file above).
Is this a bug?
Re: [share] shock contributions labels and groups
Posted:
Sun May 31, 2015 8:32 pm
by jpfeifer
Sorry, but this is no supported function of Dynare. If the original author does not help you out, you will have to solve this yourself.
Re: [share] shock contributions labels and groups
Posted:
Tue Jun 02, 2015 9:42 am
by Oriana
Thank you. I already solved it myself!