# Deal with the warning of Log zero

I set different initial value to solve this problem, but they don’t work.

I hope someone can help me, my dynare code is attached below. I appriciate!

var mc rw mrs n a r pi c news;
varexo ms lambda epsilon_a epsilon_news;

parameters sigma delta gamma rho_r gamma_y gamma_pi beta kappa_p rho_a rho_news;

sigma=0.4;
delta=0.5;
gamma=1;
rho_r=0.5;
gamma_y=0.125;
gamma_pi=1.5;
beta=0.99;
kappa_p=0.1;
rho_a=0.5;
rho_news=0.5;

model;
c=c(+1)-sigma*(r-pi(+1));
c=a+(1-delta)n;
mc=rw+n-c;
mrs=c/sigma+gamma
n;
r=rho_rr(-1)+(1-rho_r)(gamma_yc+gamma_pipi)+ms;
mrs=rw;
pi=betapi(+1)+kappa_p(mc+lambda);
a=rho_aa(-1)+news(-1)+epsilon_a;
news=rho_news
news(-1)+epsilon_news;
end;

initval;
mc=0;
rw=0;
mrs=0;
n=0;
a=0;
r=0;
pi=0;
c=0;
news=0;
end;

shocks;
var ms=0.009^2;
var lambda= 0.009^2;
var epsilon_a=0.009^2;
var epsilon_news=0.009^2;
end;

stoch_simul(periods=2000, drop=200);

Warning: Log of zero.

In log10 at 20
In dyntable at 33
In stoch_simul at 105
In homework2 at 165
In dynare at 120

What exactly is your problem? The code you posted runs fine on my machine.