# How to predict with only one shock?

Now I know that adding `smoother` in` estimation` can give us the smoothed predictions of endogenous variables and shocks. However, I only want to turn on one shock and shut down the others to see how this shock can explain the variance. Is that feasible?

It seems you are looking for the

``shock_decomposition``

command.

[quote=“jpfeifer”]It seems you are looking for the

``shock_decomposition``

command.[/quote]

Sorry that I didn’t precisely convey my question. I mean how to draw the following graphaaa.jpg.pdf (232 KB)? Specifically, how are the red and green lines drawn?

Run

``shock_decomposition``

and read out the respective contribution of particular shock in

``oo_.shock_decomposition``

and plot it along with the variable itself. Dynare does not do this automatically.

Many thanks, Prof!

I got a three dimensional array, in which the 1st dim is endogeneous variable, the 2nd dim is shocks, and the 3rd is time. However, I cannot understand inside order of the 1st dim and the 2nd dim.

I wrote

``shock_decomposition LogL, Ql, I, B, C, Y, N;``

But the length of the 1st dimension is 35 instead of 7 (there are 35 endo vars in my model). Is the order of endo vars inside the 1st dim is what I declared? The length of the 2nd dimension is 10, but there are only 8 shocks in my model (if one is the prediction with all shocks, what is the rest?).

Sorry for all the bother…and thanks again!

[quote]% function z = shock_decomposition(M_,oo_,options_,varlist)
% Computes shocks contribution to a simulated trajectory. The field set is
% oo_.shock_decomposition. It is a n_var by nshock+2 by nperiods array. The
% first nshock columns store the respective shock contributions, column n+1
% stores the role of the initial conditions, while column n+2 stores the
% value of the smoothed variables. Both the variables and shocks are stored
% in the order of declaration, i.e. M_.endo_names and M_.exo_names, respectively.[/quote]