Lucas economy with power utility

Dear all,
I am new to Dynare. As a practice, I am trying to simulate the simplest lucas economy using dynare.

My code works without any error message. Since this economy has a closed-form solution for the risk-free rate, I compare the Dynare solution with the closed-form solution, but the result is quite off. My equity premium is not even positive. It would be much appreciated if someone points out something that I did wrong.

In this economy, the risk-free rate is -log(beta)+mu* gamma-sigma^2*gamma^2/2;

Best,

var S c C R_f;
varexo shock;
parameters beta gamma mu sigma rho;

beta = 0.99;
gamma = 3;
mu = 0.02;
sigma = 0.11;
rho = 0.99;

 model;
// Exogenous consumption process (log normal)
c = rho*c(-1) + mu+sigma*shock;
C = exp(c);

// Euler equation for equity premium
1 = beta*(C(+1)/C)^(-gamma)*(S(+1)+C(+1))/S;

// Define gross risk-free rate
R_f = 1/(beta*(C(+1)/C)^(-gamma));
end;

steady_state_model;
c = mu/(1-rho);
C = exp(c);
S = C/(1/beta-1);
R_f = 1/beta;
end;

initval;
c = 0;
end;


steady;
check;

shocks;
var shock; stderr 1;
end;

stoch_simul(order=3,periods=100000,drop=1000,irf=0) S c C R_f;

You are not defining the risk-free rate correctly as you are neglecting Jensen’s Inequality. You need to have
r^f_t=\frac{1}{E_t\left(\beta\frac{C_{t+1}}{C_t}\right)}
but you have
r^f_t=E_t\frac{1}{\beta\frac{C_{t+1}}{C_t}}
which is not the same. For that reason, you need to define an auxiliary variable. Have a look at


and

Dear Professor Pfeifer,

That makes a lot of sense. I neglected the Jensen’s inequality.

I greatly appreciate your kind answer.

Best,
Kevin