Simple RBC model with unit root technology

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-bC(-1))- psiN^(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©-bexp(C(-1))(exp(A))^(-1/(1-alpha)))^-1 - betabexp(A(+1))^(-1/(1-alpha))(exp(C(+1))-bexp©*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))(alphaexp(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©+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

The way you set up the process for psi is wrong as it currently has mean 0. It must be

in the labor FOC then.

Hi,

I just tried with exp(psi) but it give me the same error.

It works with

[code]%% Model U=log(C-bC(-1))- psiN^(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;
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©-bexp(C(-1))(exp(A))^(-1/(1-alpha)))^-1 - betabexp(A(+1))^(-1/(1-alpha))(exp(C(+1))-bexp©*exp(A(+1))^(-1/(1-alpha)))^-1;

%F.O.C wrt to N

exp(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))(alphaexp(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©+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);
Y_N=Y/N;
psi=0;
lam1=0;
lam2=0;
A=a;
end;

shocks;

var ea = sea^2;
var ep = sep^2;
end;

steady(solve_algo=4,maxit=1000);
check;

stoch_simul(periods=200,order = 1,irf=15,nograph);[/code]
i.e. with no growth. This suggest your detrending is not correct. Please check the Euler equation, which looks particularly strange.

Thanks a lot. Do we always have to use euler equation? I see some codes just use F.O.C s making sure that there are enough equations to match with endogenous variables.

I am now using only F.O.C.s.

I don’t understand your question. The Euler equation is the FOC determining the consumption choice.