Help needed with mod file

Hi, I’m trying to run this file which is based on the paper by Aguiar & Gopinath (JPE 2007) “Emerging Market Business Cycles: The Cycle is the Trend”.

% 1. Defining variables
%----------------------------------------------------------------

var y c k i l B q nx n y_k c_y z g;
varexo e_z e_g;

parameters alpha beta delta gamma psi sigma phi r mu b rhoz rhog sigmaz sigmag m1 m2;

%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------

alpha   = 0.68;
beta    = 0.98;
delta   = 0.05;
gamma   = 0.36;
psi     = 0.001;
sigma   = 2;
phi     = 4;
r       = 0.01;
mu      = 1.006;
b       = 0.1;
rhoz   = 0.95; 
rhog   = 0.01;
sigmaz = 0.001;
sigmag = 0.001;

m1=gamma*(1-sigma)-1;
m2=(1-gamma)*(1-sigma);

%----------------------------------------------------------------
% 3. Model
%----------------------------------------------------------------

model; 
  c^(m1)*l^(m2)*g^(-m1)*(phi*(g*k(+1)/k-mu)+1) = beta*c(+1)^(m1)*l(+1)^(m2)
*((1-alpha)*y(+1)/k+1-delta+phi/2*((g(+1)*k(+2)/k(+1))^2-mu^2));
  c^(m1)*l^(m2)*g^(-m1)*q = beta*c(+1)^(m1)*l(+1)^(m2);
  c/l = gamma/(1-gamma)*alpha*y/(1-l);
  l = 1-n;
  y = z*k(-1)^(1-alpha)*(g*n)^(alpha);
  i = g*k-(1-delta)*k(-1)+(phi/2)*(g*(k/k(-1))-mu)^2*k(-1);
  nx = (y-c-i)/y;
  (1/q) = 1+r+psi*(exp(B(+1)-b)-1); 
  B=b*y;
  y_k=y/k;
  c_y=c/y;
  z = rhoz*z(-1)+e_z;
  g = rhog*g+e_g;
end;

%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------

initval; 
z=1;
g=1;
q=beta*mu^(m1);
y_k=((1/q)-(1-delta))/(1-alpha);
c_y=1+(1-mu-delta)/y_k-(1-mu*q)*b;
n=(1+c_y*(1-gamma)/alpha*gamma)^(-1);
k=(mu/y_k)^(1/alpha)*n; 
y=y_k*k;
c=c_y*y;
i=(mu-1+delta)*k;
nx=(y-c-i)/y;
e_z=0;
e_g=0;
end;

shocks;
var e_z = sigmaz^2;
var e_g = sigmag^2;
end;

steady;

stoch_simul(hp_filter = 1600, order = 1);

%----------------------------------------------------------------
% 5. Some Results
%----------------------------------------------------------------

statistic1 = 100*sqrt(diag(oo_.var(1:6,1:6)))./oo_.mean(1:6);
dyntable('Relative standard deviations in %',strvcat('VARIABLE','REL. S.D.'),M_.endo_names(1:6,:),statistic1,10,8,4);

I get the following error:
“Impossible to find the steady state. Either the model doesn’t have a steady state, there are an infinity of steady states, or the guess values are too far from the solution”. The thing is that both the equations of the model and the steady states, I got them from the authors’ website. So I don’t understand why this isn’t working.

Any help would be very welcome.

Thanks and regards,

The initial values that you provided are incompatible with the first three equations, you need to adjust them.

Hi Sébastien, thanks for your reply. I’m still not able to solve the problem. And I really can’t see what I’m doing wrong since I’m just coping the equations and steady states as they are presented in the program notes.pdf from the authors’ website:
[
markaguiar.com/papers/cycle_ … apage.html
]()

I’m not an experienced Dynare user, so maybe it’s just a silly mistake.

Any other comments or sugestions will be very welcome.

Thanks for your help.

Regards,