Dynare ++ versus Dynare in Matlab

Hi

I would like to use the 3rd approximation in dynare++. But by testing dynare++ I ran into the following problem. When I compute the first order approximation in dynare++, the steady state values do NOT agree with the mean values. Why is that? Attached is the mod file and Matlab output.

Thanks
Lars

MOD file:
var k, c, x;
varexo e;
parameters A, beta, rhoX, delta, RRA, nu;
A = -3;
nu = 0.9;
rhoX = 0.95;
delta = 0.03;
beta = 0.99;
RRA = 4;
model;
c^(-RRA) = betac(+1)^(-RRA)(exp(x(+1))nuk^(nu-1) + 1 - delta);
c + k = exp(x)*k(-1)^nu + (1-delta)*k(-1);
x = (1-rhoX)A + rhoXx(-1) + e;
end;
initval;
k = ( (1/beta+delta-1)/(exp(A)*nu) )^(1/(nu-1));
c = (1-delta)*k;
x = A;
e = 0;
end;
shocks;
var e=0.01^2;
end;
steady;
stoch_simul(order=1);

Matlab output:
dyn_ss

dyn_ss =

3.034153271995179
-3.000000000000000
0.044167191849358

dyn_mean

dyn_mean =

3.044558450113021
-2.998402425072781
0.044312741256193

Hi,

This is most probably because Dynare++ computes empirical moments of variables, and not theoretical moments.

Best,

Hi Sebastien

Thanks for you reply.

I am not convinced that dynare++ uses simulation to compute moments (i.e. dyn_mean).
When I rerun the code, I always get the same means up to 15 digits.

Best
Lars

Have you checked if this is due to the re-centering of the decision rules along the so-called “fix point” in the Dynare++ manual. Try invoking Dynare++ with

dynare++ --no-centralize yxz.mod
If this gives you the same mean as in Matlab, you have found your reason.

It’s not because you always get the same results for moments that they are not empirical.

The point is, as you may know, that randomness in computers is generally pseudo randomness. Most algorithms (including Dynare++) use pseudo-random generators which are deterministic sequences of apparently random numbers, starting from a “seed”.

If the seed is always the same, then the sequence of generated random numbers is always the same too.

This is what happens with Dynare++: it always uses the same seed at start-up by default. I think you can manually change the seed, see the reference manual.

Best,