SS solution cannot be found?

I am trying to replicate a small open economy RBC model (info below).
Although I am using steady state values as the initial values Dynare cannot seem to find a solution
producing the following -usual- error:

SOLVE: maxit has been reached ??? Error using ==> print_info at 52 Impossible to find the steady state. Either the model doesn't have a unique steady state of the guess values are too far from the solution

The model uses exact calibration values for the parameters in the paper.
The code is shown below. I would appreciate any help. Thanks.

[code]% RBC model for Argentina
% see J. Garcia-Cicco et al. (2010) “Real Business Cycles in Emerging Countries?”

close all

%----------------------------------------------------------------
% Defining variables
%----------------------------------------------------------------

var y c h k tb r d inv lm rp a g;

% NOTE: lm: lagrange multiplier
% rp: country risk premium

varexo e_a e_g;

parameters alpha theta beta omega psi phi gamma delta rstar dbar gbar rho_a rho_g sigma_a sigma_g;

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

alpha = 0.32;
theta = 2.24;
omega = 1.6;
phi = 3.3;
psi = 0.001;
gamma = 2;
delta = 0.1255;
beta = 0.9224;
dbar = 0.007;
gbar = 1.005;
rstar = 1/beta*gbar^gamma-1;
rho_a = 0.765;
sigma_a = 0.027;
rho_g = 0.828;
sigma_g = 0.03;

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

model;
lm = (c-thetah^omega/omega)^(-gamma);
rp = psi
(exp(d(-1)-dbar)-1);
r = rstar + rp;
tb = y - c - inv - ((phi/2)(gk/k(-1)-gbar)^2)k(-1);
d
g/(1+r) = d(-1)-tb;
inv = kg-(1-delta)k(-1);
y = exp(a)k(-1)^alpha(g
h)^(1-alpha);
theta
h^(gamma-1) = exp(a)(1-alpha)g^(1-alpha)(k(-1)/h)^alpha;
lm
g^gamma = (beta)(1+r)lm(+1);
(g^gamma)lm(1+phi
((k/k(-1))g-gbar)) = (beta)lm(+1)(1-delta+alphaexp(a(+1))
(g(+1)h(+1)/k)^(1-alpha)
+phi
(k(+1)/k)g(+1)((k(+1)/k)g(+1)-gbar)-0.5phi*((k(+1)/k)g(+1)-gbar)^2);
a = rho_a
a(-1) + e_a;
log(g) = (1-rho_g)log(gbar) + rho_glog(g(-1)) + e_g;
end;

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

initval;
y = 0.2217;
c = 0.1791;
h = 0.1851;
k = 0.3217;
r = rstar;
d = dbar;
inv = 0.042;
tb = y-c-inv;
lm = 138.3395;
rp = 0;
a = 0;
g = gbar;
end;

shocks;
var e_a = sigma_a^2;
var e_g = sigma_g^2;
end;

check;
resid(1);
steady(solve_algo=3);[/code]

Remove the CHECK command that can only be computed at the steady state. You will then see the output from RESID(1) that shows that equations 1 and 8 are not satisfied by the values declared in INITVAL. There is either a problem with these values or with the equations.

Best

Michel

Thanks Michel. Following your suggestion I was able to initiate the solution. But the residual for the first equation still seems to be larger:

Residual for equation number 1 is equal to 0.12592
Residual for equation number 2 is equal to 0
Residual for equation number 3 is equal to 3.2524e-006
Residual for equation number 4 is equal to 0
Residual for equation number 5 is equal to -2.4142e-005
Residual for equation number 6 is equal to -1.1e-006
Residual for equation number 7 is equal to -1.2766e-005
Residual for equation number 8 is equal to -0.00010025
Residual for equation number 9 is equal to -0.00053358
Residual for equation number 10 is equal to 0.0025344
Residual for equation number 11 is equal to 0
Residual for equation number 12 is equal to 0
Residual for equation number 13 is equal to 0

Curious thing is that when I use the same SS values in my matlab steady state file the roots are
1.0e-012 *

-0.1990
-0.0000
-0.0000
0.0000
0
-0.0001
0
0.0001
0
0

for the first eleven variables.

Also I was able to obtain a solution for order=1 only. Second order aproximation produces NaNs. I tried options_.pruning=1 without success.
I guess first order approximation will suffice for now.

  1. The fact that the residual on the first equation is large and that with your MATLAB program for SS you find, as you should, very small residuals, indicate that this first equation is not identical in the Dynare *.mod file and your Matlab program
  2. It is common to obtain NaN in second order approximation.
  3. Pruning should help. What to you mean by “trying options_.pruning =1 without success”? Did you get an error message? Are you using dynare-unstable? Pruning is only available is that version. If necessary, please, send me your *.mod file

Best

Michel

Michel you are right pruning works under dynare unstable which I also added to the matlab path.

Thanks

Huseyin

Now I can solve and simulate values for the levels of statitonarized variables but when I try to estimate I get the following error

Error in computing likelihood for initial parameter values
??? Error using ==> print_info at 52
Impossible to find the steady state. Either the model doesn’t have a unique steady state of the guess values are
too far from the solution

Error in ==> initial_estimation_checks at 101
print_info(info, options_.noprint)

Do I need to write a separate steady state matlab file? If so is there an example _steadystate.m file? User guide does not contain an example on this.

Thanks

Please, post the Matlab program that you use for computing the steady state and I will show you how to use it with Dynare

Best

Michel

I realized that there was a mistake in the code in my first entry to this subject. The correct one with SS values as the initial conditions is posted below.
This code runs correctly. But when estimating only mode_compute=6 option works.

close all

%----------------------------------------------------------------
% Defining variables
%----------------------------------------------------------------

var y c h k tb tby r d inv lm rp a g gy gc gi;

% NOTE: lm: lagrange multiplier
%       rp: country risk premium


varexo e_a e_g;

parameters alpha theta beta omega psi phi gamma delta rstar dbar gbar rho_a rho_g sigma_a sigma_g;

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

alpha   = 0.32;
theta   = 2.24; 
omega   = 1.6;
phi     = 3.3;
psi     = 0.001;
gamma   = 2;
delta   = 0.1255;
beta    = 0.9224;
dbar    = 0.007; 
gbar    = 1.005;
rstar   = 1/beta*gbar^gamma-1;
rho_a   = 0.765;
sigma_a = 0.027;
rho_g   = 0.828;
sigma_g = 0.03;

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

model;
  lm = (c-theta*h^omega/omega)^(-gamma);
  rp = psi*(exp(d(-1)-dbar)-1);
  r = rstar + rp;
  tb = y - c - inv - ((phi/2)*(g*k/k(-1)-gbar)^2)*k(-1);
  d*g/(1+r) = d(-1)-tb;
  inv  = k*g-(1-delta)*k(-1); 
  y = exp(a)*k(-1)^alpha*(g*h)^(1-alpha);
  theta*h^(omega-1) = exp(a)*(1-alpha)*g^(1-alpha)*(k(-1)/h)^alpha;
  lm*g^gamma = (beta)*(1+r)*lm(+1); 
  (g^gamma)*lm*(1+phi*((k/k(-1))*g-gbar)) = (beta)*lm(+1)*(1-delta+alpha*exp(a(+1))*(g(+1)*h(+1)/k)^(1-alpha)
             +phi*(k(+1)/k)*g(+1)*((k(+1)/k)*g(+1)-gbar)-0.5*phi*((k(+1)/k)*g(+1)-gbar)^2);
  tby = tb/y;
  a = rho_a*a(-1) + e_a;
  log(g) = (1-rho_g)*log(gbar) + rho_g*log(g(-1)) + e_g;
  gy =  log(y)-log(y(-1))+log(g(-1));
  gc =  log(c)-log(c(-1))+log(g(-1));
  gi =  log(inv)-log(inv(-1))+log(g(-1));
end;

%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------
initval;
r = rstar;
d = dbar;
h = ((1-alpha)*gbar*( ((gbar^gamma/beta - 1 + delta)/alpha)^(1/(alpha-1)) )^alpha/theta)^(1/(omega-1));
k = ( ((gbar^gamma/beta - 1 + delta)/alpha)^(1/(alpha-1)) )*gbar*h;
inv = (gbar-1+delta)*k;
y = k^alpha*(h*gbar)^(1-alpha);
c = (gbar/(1+r)-1)*d+y-inv;
tb = y-c-inv;
tby = tb/y;
lm = (c-(theta/omega)*h^omega)^(-gamma);
a = 0; 
g = gbar;
rp = 0;
end;

shocks;
var e_a = sigma_a^2;
var e_g = sigma_g^2;
end;

%check;
resid(1); 
steady(solve_algo=3);

I have been trying to work with the same model (same paper) and I have the following after I run the program:

??? Error using ==> steady_ at 132
STEADY: convergence problems

Error in ==> steady at 54
steady_;

Error in ==> model2 at 156
steady;

Error in ==> dynare at 120
evalin(‘base’,fname) ;

Does anyone know what I have done to not achieve the steady state? I even adapted some initial values to be close to the model used here.

Thanks in advance

[code]// Model Garcia-Cicco

var y, c, h, k, d, r, a, g, x;
varexo ea, eg, rw;

parameters gamma, theta, beta, alpha, delta, rhoa, rhog, psi, phi, omega, dbar, gbar;

gamma = 2.00;
theta = 2.24;
beta = 0.9224;
alpha = 0.32;
delta = 0.1255;
rhoa = 0.765;
rhog = 0.828;
psi = 0.001;
phi = 3.3;
omega = 1.6;
dbar = 0.007;
gbar = 1.005;

model;
h^(omega) = (1-alpha)y/(thetax(-1));
(c(+1) - ((theta)x(h(+1)^(omega))/(omega)))^(gamma)/(c - ((theta)x(-1)(h^(omega))/(omega)))^(gamma) = beta*(1+r);
k = beta*(c - ((theta)x(-1)(h^(omega))/(omega)))^(gamma)(alphay(+1) + k*(1 - delta - (phi/2)((k(+1)/k - g)^2 - 2k(+1)/k*(k(+1)/k - g))))/((c(+1) - ((theta)x(h(+1)^(omega))/(omega)))^(gamma)(1 + phi((k/k(-1))-g)));
y = a*(k(-1)^(alpha))((xh)^(1-alpha));
ln(a) = rhoaln(a(-1)) + ea;
k = y - c + (1-delta)k(-1);
r = rw + psi
(exp((d/x)-dbar)-1);
g = x/x(-1);
ln(g(+1)/gbar) = rhog
ln(g/gbar) + eg;
end;

initval;
y = 0.2217;
c = 0.1791;
h = 0.1851;
k = 0.3217;
d = dbar;
r = rw;
a = 1;
g = gbar;
x = 1;
ea = 0;
eg = 0;
rw = 0.04;

end;

steady;
solve_algo = 1;

shocks;
var ea; stderr 0.027;
var eg; stderr 0.03;
end;

stoch_simul;[/code]
model2.mod (1.11 KB)

You can find a replication file for the model on my homepage at sites.google.com/site/pfeiferecon/dynare