[share] shock contributions labels and groups

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

[share] shock contributions labels and groups

Postby Vermandel » Fri Apr 19, 2013 9:46 am

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.

Image

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).
Attachments
shock_decomposition.m
/dynare/matlab/
(3.09 KiB) Downloaded 412 times
graph_decomp.m
/dynare/matlab/
(3.81 KiB) Downloaded 461 times
Last edited by Vermandel on Tue Nov 19, 2013 4:38 pm, edited 2 times in total.
Vermandel
 
Posts: 7
Joined: Wed Jul 06, 2011 11:06 am
Location: Paris

Re: [share] shock contributions labels and groups

Postby jpfeifer » Sat Apr 20, 2013 7:57 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: [share] shock contributions labels and groups

Postby costa » Thu Nov 14, 2013 8:51 pm

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.
costa
 
Posts: 47
Joined: Thu Nov 14, 2013 8:09 pm

Re: [share] shock contributions labels and groups

Postby federico » Sat Nov 16, 2013 10:24 am

before the shock decomposition command
federico
 
Posts: 68
Joined: Fri Mar 30, 2012 4:46 pm

Re: [share] shock contributions labels and groups

Postby costa » Sat Nov 16, 2013 10:09 pm

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;
costa
 
Posts: 47
Joined: Thu Nov 14, 2013 8:09 pm

Re: [share] shock contributions labels and groups

Postby federico » Mon Nov 18, 2013 9:24 am

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.
federico
 
Posts: 68
Joined: Fri Mar 30, 2012 4:46 pm

Re: [share] shock contributions labels and groups

Postby Vermandel » Tue Nov 19, 2013 4:45 pm

here is attached an example file with Smets & Wouters codes.
Attachments
Smets_Wouters_2007_Dynare425.zip
(22.78 KiB) Downloaded 406 times
Vermandel
 
Posts: 7
Joined: Wed Jul 06, 2011 11:06 am
Location: Paris

Re: [share] shock contributions labels and groups

Postby costa » Sun Dec 01, 2013 6:45 pm

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?
costa
 
Posts: 47
Joined: Thu Nov 14, 2013 8:09 pm

Re: [share] shock contributions labels and groups

Postby federico » Mon Dec 02, 2013 9:11 am

It works surely under dynare version 4.2.5
federico
 
Posts: 68
Joined: Fri Mar 30, 2012 4:46 pm

Re: [share] shock contributions labels and groups

Postby Oriana » Sat May 30, 2015 11:15 am

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?
Attachments
nonlinearomega-2 2 USA 2.zip
(553.53 KiB) Downloaded 324 times
Oriana
 
Posts: 67
Joined: Fri Jul 18, 2014 2:49 pm

Re: [share] shock contributions labels and groups

Postby jpfeifer » Sun May 31, 2015 8:32 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: [share] shock contributions labels and groups

Postby Oriana » Tue Jun 02, 2015 9:42 am

Thank you. I already solved it myself!
Oriana
 
Posts: 67
Joined: Fri Jul 18, 2014 2:49 pm


Return to Dynare contributions and examples

Who is online

Users browsing this forum: No registered users and 1 guest