Oo_.endo_simul & oo_.irfs

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

  1. See
  1. oo_.endo_simul contains a simulation with shocks happening every single period. oo_.irfs is the response after a one-time 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 (Cobb-Douglas) output, thus subject to the aggregate technology shock. Why is it the case that if I set phi=0, I still get non-zero 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 non-zero.

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)-(1-delta)))^(1/(1-alpha)))*n_ssB;
r_ssB = (1/(beta))-1;
w_ssB = (1-alpha)*(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/(1-rho));

model;
CB = (wB*(1-nB))/((1-phi)*theta);
CB = (1-phi)*CB(+1)/(beta*(1-phi)*(1+rB));
wB = (1-alpha)*A*(kB(-1))^(alpha)*nB^(-alpha);
kB = (((rB+delta)/(alpha*A(+1)))^(1/(alpha-1)))*nB(+1);
kB = (1-delta)*kB(-1)+IB;
YB = A*(kB(-1))^(alpha)*nB^(1-alpha);
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.5517e-33 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 y-axis scaling.

1 Like