In a deterministic setup, could you please help me understand why I get close but different numerical results when I use the predetermined_variables command or not (see my example below).

Thanks a lot for your help.

Best regards,
Thibaut

Formulation 1:

[…]

model;
# I = K(-1)((q-1)/((1+a)b))^(1/a);
# w = alphaK(-1)^(alpha-1)+ab*(I/K(-1))^(a+1);
K = K(-1) + (I-delta*K(-1))dt;
q(+1) = q + (r+delta)qdt - wdt;
end;

[…]

simul(periods=100);

Formulation 2

[…]

predetermined_variables K;

[…]

model;
# I = K*((q-1)/((1+a)b))^(1/a);
# w = alphaK^(alpha-1)+ab(I/K)^(a+1);
K(+1) = K + (I-delta*K)dt;
q(+1) = q + (r+delta)qdt - wdt;
end;

I have added the options tolx=1e-12 and tolf=1e-12 in the simul command but the results are exactly the same. The second value for K for example is 20.916777 in the first formulation, and 20.892891 in the second.

I was expected both formulations to be strictly equivalent. Are the computations not strictly the same? Could you please explain me why?

Thanks a lot
Thibaut

var K q;
//predetermined_variables K;
parameters
a b delta r alpha dt
K_inf q_inf;
a=1;
b=1;
delta = 0.023;
alpha = 0.33;
r = 0.01;
dt=1;
q_inf = 1+(1+a)*b*delta^a;
K_inf = (((r+delta)*q_inf-a*b*delta^(a+1))/alpha)^(1/(alpha-1));
// Model block without predetermined_variables statement
model;
# I = K(-1)*((q-1)/((1+a)*b))^(1/a);
# w = alpha*K(-1)^(alpha-1)+a*b*(I/K(-1))^(a+1);
K = K(-1) + (I-delta*K(-1))*dt;
q(+1) = q + (r+delta)*q*dt - w*dt;
end;
// Model block with predetermined_variables statement
/*
model;
# I = K*((q-1)/((1+a)*b))^(1/a);
# w = alpha*K^(alpha-1)+a*b*(I/K)^(a+1);
K(+1) = K + (I-delta*K)*dt;
q(+1) = q + (r+delta)*q*dt - w*dt;
end;\
*/
steady_state_model;
K = K_inf;
q = q_inf;
end;
initval;
K = 20;
q = q_inf;
end;
endval;
K = K_inf;
q = q_inf;
end;
check;
simul(periods=100, tolx=1e-12, tolf=1e-12, no_homotopy);
rplot K;
rplot q;
dynatype(K_saddle_path_values) K;
dynatype(q_saddle_path_values) q;

I can read in the NEWS file that this bug has been corrected in version 4.5.5.

However, I have downloaded version 4.5.6 (log says “Starting Dynare (version 4.5.6).”) and I experience exactly the same bug with the exact same values for K in the example above (20.916777 versus 20.892891).