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 Smets/Wouters (2007) in Dynare 4.2.5 , adding at the end of the mod file :
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). shock_decomposition.m (3.09 KB) graph_decomp.m (3.81 KB)
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.
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.
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.
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?
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? nonlinearomega-2 2 USA 2.zip (554 KB)