How to do variance decomposition in dynare?

hello, every body. i have a question.

suppose the dynare code is as follows:

var xxxxx;
varexo xxxxxxx ;
parameters xxxxxx;
model(linear);
y = xxxxx
……
end;
check;

shocks;
var ……
end;

estimated_params;
xxxx, normal_pdf, 0.03, 0.01;
……
stderr epsilon_r, inv_gamma_pdf, 0.01, inf;
….
end;

varobs y pi;

stoch_simul(irf=40, periods=600) y pi r;

estimation(datafile=data, prefilter=1, first_obs=1, mh_drop=0.45, mode_compute=4, mode_check, mh_replic=20000);

my question is , how to add a command to let the dynare do variance decomposition? i mean both the command and where to put it.

See the manual on conditional_variance_decomposition.

thanks for ur help.

i have added the “conditional_variance_decomposition” command this:

stoch_simul(irf=40, periods=600, conditional_variance_decomposition=40) y pi r;

here is my mod file. thanks!
bbb.mod (2.22 KB)

It only works with theoretical moments and only at first order as variance decomposition for nonlinear systems are state-dependent. Hence, set order=1 and periods=0.

when i do as u say, the dynare did give a variance decomposition report. but the trouble is that there is only one report. you know, in many papers, the variance decomposition report usually includes several different horizons, such as 1 quarter, 4 quarters, 8 quarters, 16 quarters, 32 quarters, etc. how can i do this in my dynare code? thanks.

it works. thank u so much.

Thanks a lot for this too.

Hello
Just eliminate command “periods” in last line