Shock decomposition - shocks names display

Hi,

I’m using Dynare version 4.4.3 on Matlab R2017a.

I have troubles displaying shock names on the graph of the shock decomposition.

I tried:

options_.groups{1}={'eps_A'};
options_.groups{2}={'eps_B'};
options_.groups{3}={'eps_AK'};
options_.groups{4}={'eps_C'};
options_.groups{5}={'eps_ei'};
options_.groups{6}={'eps_rp'};
options_.groups{7}={'eps_z'};
options_.labels = char('Labor-augmenting tech.', 'Labour supply', 'IST', 'Discount factor' , 'MEI', 'Risk premium', 'TFP');
shock_decomposition(datafile=data_q_new,parameter_set=posterior_mean) RR_f;

But no names appear.

I also tried:

shock_groups(name=group1);
'Labor-augmenting tech.'=eps_A;
'Labour supply'=eps_B;
'IST'=eps_AK;
'Discount factor'=eps_C;
'MEI'=eps_ei;
'Risk premium'=eps_rp;
'TFP'=eps_z;
end;
shock_decomposition(datafile=data_q_new,parameter_set=posterior_mean,use_shock_groups=group1) RR_f;

as in Dynare manual, but I got this error when I add an option inside the function shock_decomposition

syntax error, unexpected NAME, expecting DATAFILE or PARAMETER_SET

Thanks for your help!

That feature has been introduced in Dynare 4.5 if I remember correctly. Please upgrade and try again.

1 Like

Thanks for your reply. I’m going to plot the graph in Matlab then.

Another question if I may: why are my smooth estimates (oo_.SmoothedVariables) slightly different from the smoothed variables I can find in the shock decomposition (i.e. aggregating all shocks + initial condition) ?

That should be Jensen’s Inequality. The mean of the smoothed objects over the different parameter vectors from estimation is different from the smoothed object at the mean parameter vector.

1 Like

could you please share with me your code for manually plottting shock decomposition graphs with Matlab? Thanks in advance!

In Dynare 4.5.7 the following will work

for var_iter=1:M_.orig_endo_nbr
    var_name=M_.endo_names(var_iter,:);
    xlswrite('Shock_decomp_results',[cellstr(M_.exo_names);'Initial';'Variable Value'],var_name,'A2')
    xlswrite('Shock_decomp_results',1:options_.nobs,var_name,'B1')
    xlswrite('Shock_decomp_results',squeeze(oo_.shock_decomposition(var_iter,:,:)),var_name,'B2')
end

Sorry Julie, looks like I didn’t keep the code.