# Stochastic volatility in Dynare++

Dear friends,

I am having a few problems in comparing Dynare and Dynare++ impuse response functions for a very simple model of stochastic volatility (codes for test.mod for Dynare and test_dpp.mod for Dynare++ quoted below*). What is really strange is that, when simulating both files using a linear approximation, Dynare (correctly) provides IRFs only for the stochastic volatility of the shock, while Dynare++ provides some numbers for other variables that don’t make sense.

There are other issues I found playing with both codes, sometimes with Dynare providing the expected answer, sometimes with Dynare++ with an appropriate response. But I think it is better, for the sake of simplicity, to start with this simple model.

Any help would be greatly appreciated.

Thanks,

Angelo
(*) I’m an old user of the forum, but unfortunately I’m having problems to reset my account…

Code for test.mod:

var pi r sigma_epsr;
varexo epsr eps_sig eps_e;
parameters RHO_R RHO_PI pi_ss r_ss sigma_epsr_ss rho_sig tau;
RHO_R = 0.8;
RHO_PI = 1.1;
pi_ss = 1;
r_ss = 1;
sigma_epsr_ss = 0.003;
rho_sig = 0.5;
tau = sqrt(0.5);
model;
r = r_ss + RHO_R*(r(-1) - r_ss) + RHO_PI*(pi-pi_ss) + exp(sigma_epsr)epsr;
sigma_epsr = (1-rho_sig)sigma_epsr_ss + rho_sigsigma_epsr(-1) + tau
eps_sig;
pi = (1-rho_sig)pi_ss + rho_sigpi(+1) + eps_e;
end;
r = (r_ss);
pi = (pi_ss);
sigma_epsr = sigma_epsr_ss;
end;
shocks;
var epsr = 1;
var eps_sig = 1;
var eps_e = 1;
end;
stoch_simul(order=1,irf=20,pruning);

Code for test_dpp.mod:

var pi r sigma_epsr;
varexo epsr eps_sig eps_e;
parameters RHO_R RHO_PI pi_ss r_ss sigma_epsr_ss rho_sig tau;
RHO_R = 0.8;
RHO_PI = 1.1;
pi_ss = 1;
r_ss = 1;
sigma_epsr_ss = 0.003;
rho_sig = 0.5;
tau = sqrt(0.5);

model;
r = r_ss + RHO_R*(r(-1) - r_ss) + RHO_PI*(pi-pi_ss) + exp(sigma_epsr)epsr;
sigma_epsr = (1-rho_sig)sigma_epsr_ss + rho_sigsigma_epsr(-1) + tau
eps_sig;
pi = (1-rho_sig)pi_ss + rho_sigpi(+1) + eps_e;
end;

initval;
r = (r_ss);
pi = (pi_ss);
sigma_epsr = sigma_epsr_ss;
end;

vcov = [1 0 0
0 1 0
0 0 1];

Dear Angelo,

What is your problem with the new forum? Did you try to attach the mod file? Some multiplication symbols are missing in the code you put in the post.

Best,
Stéphane.

Dear Stephane,

I had to create a new account, since I was not receiving the confirmation e-mail to reset my password. I checked the box for blocked messages, and there was nothing there. I didn’t post the code because I’m a “new user”…

Thanks,

Angelo

Dear Angelo,

That’s weird… Maybe you did not wait enough time. I have just granted you the permissions to attach files. Can you try again?

Best,
Stéphane.

Thanks, Stéphane.

Attached, as mentioned in the first message, both files with the model for stochastic volatility.

Best,

Angelo

test_dpp.mod (591 Bytes)
test.mod (688 Bytes)

What exactly is puzzling you? Dynare++ generates generalized IRFs. You will really need a lot of replications to get close to 0 IRFs for the other variables. Compare
`dynare++ --order=1 --no-centralize --irfs eps_sig --sim 50000 test_dpp.mod`
to
`dynare++ --order=1 --no-centralize --irfs eps_sig --sim 5000 test_dpp.mod`

Ok. I thought that, numerically, the irfs should be zero to all other variables. But the girf also adds perturbations to other states of the economy, right?

Yes, the other shocks are integrated out, i.e. are 0 on average. But due to short samples, you may get non-zero IRFs.