Dear Professor Pfeifer,
I have a stochastic model with 5 socks, after the Estimation, and running stoch_simul, I check the simulated variables in oo_.endo_simul : some variables which could not be negative (e.g consumption, investment etc) are negative in oo_.endo_simul . does this mean something wrong?!
And a general (stupid) question: what is the relation between data in oo_.endo_simul and oo_.irfs, does dynare use one of them to calculate another one?
Thank you in advance,
Leo
 See

oo_.endo_simul
contains a simulation with shocks happening every single period.oo_.irfs
is the response after a onetime shock.
Hi Johannes,
I have a (maybe trivial) issue that I donâ€™t get solved. Suppose I define a new variable in my model x = phi*y, where phi is a parameter and y can be the standard (CobbDouglas) output, thus subject to the aggregate technology shock. Why is it the case that if I set phi=0, I still get nonzero IRFs for x?
Thank you in avance for your help.
I would need to see the code for that. Sounds like a bug.
Please find the code below. The model may be not â€ścorrectâ€ť from the modelling perspective. Abstracting from that, however, from a computational point of view I find puzzling that the IRF is not (correctly) displayed if I set chi=0 but, at the same time, oo_.irfs_X.ea is nonzero.
var C, CB, wB, W, rB, Rk, kB, K, nB, N, IB, I,
YB, Y, A, XB, X;
varexo ea;
parameters alpha, beta, chi, delta, gamma, phi, rho, theta,
r_ssB, n_ssB, k_ssB, w_ssB, I_ssB, Y_ssB,C_ssB, A_ss;
gammas = [0.2 0.8];
for ss = 1:length(gammas);
gamma = gammas(ss);
chi = 0;
alpha = 0.33;
beta = 0.99;
delta = 0.025;
phi = 0.7;
rho = 0.95;
theta = 2.043;
n_ssB = 0.30;
k_ssB = ((alpha/((1/beta)(1delta)))^(1/(1alpha)))*n_ssB;
r_ssB = (1/(beta))1;
w_ssB = (1alpha)*(k_ssB/n_ssB)^(alpha);
I_ssB = delta*(k_ssB/n_ssB)*n_ssB; %%
Y_ssB = ((k_ssB/n_ssB)^(alpha))*n_ssB; %%
C_ssB = n_ssB*((k_ssB/n_ssB)^(alpha)delta*(k_ssB/n_ssB));
Y_ss = gamma*Y_ssB;
A_ss = exp(ea/(1rho));
model;
CB = (wB*(1nB))/((1phi)*theta);
CB = (1phi)*CB(+1)/(beta*(1phi)*(1+rB));
wB = (1alpha)*A*(kB(1))^(alpha)*nB^(alpha);
kB = (((rB+delta)/(alpha*A(+1)))^(1/(alpha1)))*nB(+1);
kB = (1delta)*kB(1)+IB;
YB = A*(kB(1))^(alpha)*nB^(1alpha);
ln(A) = rho*ln(A(1))+ea;
XB = chi*YB;
YB = CB+IB;
Y = gamma*YB;
C = gamma*CB;
I = gamma*IB;
N = gamma*nB;
K = gamma*kB;
W = gamma*wB;
Rk = gamma*rB;
X = gamma*XB;
end;
initval;
CB = C_ssB;
YB = Y_ssB;
Y = Y_ss;
wB = w_ssB;
rB = r_ssB;
kB = k_ssB;
nB = n_ssB;
IB = I_ssB;
A = A_ss;
XB = Y_ssB;
end;
resid;
steady;
shocks;
var ea; stderr 0.01;
end;
stoch_simul(order=1) Y C I K N X;
end;
The value in oo_.irfs.X_ea(1)
is 1.5517e33
which is a close to the exact solution of 0 as it gets.
Does it mean that is it only a tolerance issue? When making â€śpersonalizedâ€ť subplots itâ€™s very misleading to see the variable involved actually reacting to the shock, whereas it should be zero by construction.
Thanks a lot for your clarification.
Yes, itâ€™s a numerical tolerance issue. And no, itâ€™s not misleading. You need to consider the yaxis scaling.