Simple RBC model with unit root technology

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Simple RBC model with unit root technology

Postby Feroza » 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
Feroza
 
Posts: 7
Joined: Sun May 15, 2016 9:53 pm

Re: Simple RBC model with unit root technology

Postby jpfeifer » Tue May 17, 2016 6:06 pm

The way you set up the process for psi is wrong as it currently has mean 0. It must be
Code: Select all
exp(psi)

in the labor FOC then.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Simple RBC model with unit root technology

Postby Feroza » Tue May 17, 2016 7:45 pm

Hi,

I just tried with exp(psi) but it give me the same error.
Feroza
 
Posts: 7
Joined: Sun May 15, 2016 9:53 pm

Re: Simple RBC model with unit root technology

Postby jpfeifer » Tue May 17, 2016 8:11 pm

It works with
Code: Select all
%% 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;
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

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))*(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);
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);

i.e. with no growth. This suggest your detrending is not correct. Please check the Euler equation, which looks particularly strange.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Simple RBC model with unit root technology

Postby Feroza » Tue May 17, 2016 8:53 pm

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.
Feroza
 
Posts: 7
Joined: Sun May 15, 2016 9:53 pm

Re: Simple RBC model with unit root technology

Postby jpfeifer » Wed May 18, 2016 9:43 am

I don't understand your question. The Euler equation is the FOC determining the consumption choice.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 14 guests