Simple RBC model with unit root technology
Posted: Sun May 15, 2016 10:24 pm
Hi,
I am trying to run a simple RBC model with habit persistence utility function and permanent technology shock(unit root process). I make the model stationary dividing all variables by A(t)^(1/(1-alpha)).
However, I receive the following error :
SOLVE: maxit has been reached
Residuals of the static equations:
Equation number 1 : 2.8205
Equation number 2 : -0.064526
Equation number 3 : 0.03409
Equation number 4 : -0.17812
Equation number 5 : 0.0012854
Equation number 6 : 1.8284
Equation number 7 : 1.8596
Equation number 8 : 0.073409
Equation number 9 : 0
Equation number 10 : 0
Error using print_info (line 74)
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
Error in steady (line 92)
print_info(info,options_.noprint, options_);
Error in RBC_unit_root_tech (line 173)
steady;
My code is :
%% Model U=log(C-b*C(-1))- psi*N^(1+1/eta)/(1+1/eta)
%% C+I=AK^alpha*N^(1-alpha)
%% K(+1)=(1-delta)*K + I.
%% lnA=a+lnA(-1)+ea
var Y C I K N Y_N lam1 lam2 A psi;
varexo ea ep ;
parameters b a alpha, delta, beta,rhop,eta,sea, sep;
b=0.9;
a=0.0362;
alpha=0.33;
delta=.025;
beta=0.9;
rhop=0.95;
eta=0.5;
sea=0.66;
sep=0.15;
model;
%F.O.C. wrt to C
exp(lam1)=(exp(C)-b*exp(C(-1))*(exp(A))^(-1/(1-alpha)))^-1 - beta*b*exp(A(+1))^(-1/(1-alpha))*(exp(C(+1))-b*exp(C)*exp(A(+1))^(-1/(1-alpha)))^-1;
%F.O.C wrt to N
psi*exp(N)^(1/eta)=exp(lam1)*exp(A)^(-alpha/(1-alpha))*exp(K(-1))^(alpha)* (exp(N)^(-alpha))*(1-alpha);
%F.O.C. wrt Kt+1
exp(lam2)=beta*(exp(lam1(+1))*exp(A(+1))^(-alpha/(1-alpha))*(alpha*exp(K)^(alpha-1))* exp(N(+1))^(1-alpha) + exp(lam2(+1))*(1-delta)*exp(A(+1))^(-1/(1-alpha)));
%F.O.C wrt I
exp(lam1)=exp(lam2);
%Capital Accumulation
exp(K)=(1-delta)*exp(K(-1))*exp(A)^(-1/(1-alpha))+exp(I);
%production function
exp(Y)= exp(A)*exp(K(-1))^alpha * exp(N)*(1-alpha);
%resource constraint
exp(C)+exp(I)=exp(Y);
% labor productivity
exp(Y_N)=exp(Y/N);
%shock
A=a+ea;
psi=rhop*psi(-1)+ep;
end;
initval;
K = log(27);
Y = log(3);
C = log(2);
I = log(0.25);
N = log(0.5);
psi=1;
lam1=0;
lam2=0;
end;
shocks;
var ea = sea^2;
var ep = sep^2;
end;
steady;
check;
stoch_simul(periods=200,order = 1,irf=15,nograph);
I think it may be a problem of time convention. I checked my code several times but could not understand what's wrong with it. If anyone can help , I would really appreciated.
Thanks
I am trying to run a simple RBC model with habit persistence utility function and permanent technology shock(unit root process). I make the model stationary dividing all variables by A(t)^(1/(1-alpha)).
However, I receive the following error :
SOLVE: maxit has been reached
Residuals of the static equations:
Equation number 1 : 2.8205
Equation number 2 : -0.064526
Equation number 3 : 0.03409
Equation number 4 : -0.17812
Equation number 5 : 0.0012854
Equation number 6 : 1.8284
Equation number 7 : 1.8596
Equation number 8 : 0.073409
Equation number 9 : 0
Equation number 10 : 0
Error using print_info (line 74)
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
Error in steady (line 92)
print_info(info,options_.noprint, options_);
Error in RBC_unit_root_tech (line 173)
steady;
My code is :
%% Model U=log(C-b*C(-1))- psi*N^(1+1/eta)/(1+1/eta)
%% C+I=AK^alpha*N^(1-alpha)
%% K(+1)=(1-delta)*K + I.
%% lnA=a+lnA(-1)+ea
var Y C I K N Y_N lam1 lam2 A psi;
varexo ea ep ;
parameters b a alpha, delta, beta,rhop,eta,sea, sep;
b=0.9;
a=0.0362;
alpha=0.33;
delta=.025;
beta=0.9;
rhop=0.95;
eta=0.5;
sea=0.66;
sep=0.15;
model;
%F.O.C. wrt to C
exp(lam1)=(exp(C)-b*exp(C(-1))*(exp(A))^(-1/(1-alpha)))^-1 - beta*b*exp(A(+1))^(-1/(1-alpha))*(exp(C(+1))-b*exp(C)*exp(A(+1))^(-1/(1-alpha)))^-1;
%F.O.C wrt to N
psi*exp(N)^(1/eta)=exp(lam1)*exp(A)^(-alpha/(1-alpha))*exp(K(-1))^(alpha)* (exp(N)^(-alpha))*(1-alpha);
%F.O.C. wrt Kt+1
exp(lam2)=beta*(exp(lam1(+1))*exp(A(+1))^(-alpha/(1-alpha))*(alpha*exp(K)^(alpha-1))* exp(N(+1))^(1-alpha) + exp(lam2(+1))*(1-delta)*exp(A(+1))^(-1/(1-alpha)));
%F.O.C wrt I
exp(lam1)=exp(lam2);
%Capital Accumulation
exp(K)=(1-delta)*exp(K(-1))*exp(A)^(-1/(1-alpha))+exp(I);
%production function
exp(Y)= exp(A)*exp(K(-1))^alpha * exp(N)*(1-alpha);
%resource constraint
exp(C)+exp(I)=exp(Y);
% labor productivity
exp(Y_N)=exp(Y/N);
%shock
A=a+ea;
psi=rhop*psi(-1)+ep;
end;
initval;
K = log(27);
Y = log(3);
C = log(2);
I = log(0.25);
N = log(0.5);
psi=1;
lam1=0;
lam2=0;
end;
shocks;
var ea = sea^2;
var ep = sep^2;
end;
steady;
check;
stoch_simul(periods=200,order = 1,irf=15,nograph);
I think it may be a problem of time convention. I checked my code several times but could not understand what's wrong with it. If anyone can help , I would really appreciated.
Thanks