Hello!
I m trying to incorporate search frictions in the labour side of an RBC model. The original RBC code is the following
close all;
warning off ;
%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------
// Endogenous variables (13)
var y c h ii la k a g r; //
// Exogenous variables (3)
varexo u_a u_g;
// Parameters (17)
parameters BETA DELTA OMEGA ALPHA GAMMA;
parameters RHO_a SIGMA_a RHO_g SIGMA_g;
parameters g_ss a_ss g_to_y_ss r_ss h_ss;
%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------
// Calibarted parameteres (BETA, OMEGA, g_ss are determined in teh calibration)
DELTA=0.023;
ALPHA=0.33;
GAMMA=1;
RHO_a=0.95;
SIGMA_a=0.01;
RHO_g=0.90;
SIGMA_g=0.01;
// Targeted steady state values
a_ss=1;
g_to_y_ss=0.1;
r_ss=0.04/4;
h_ss=0.3;
%----------------------------------------------------------------
% 3. Model (13 equations)
%----------------------------------------------------------------
model;
exp(la)=exp(c)^(-GAMMA)*(1-exp(h))^(OMEGA*(1-GAMMA));
OMEGA*exp(c)/(1-exp(h))=(1-ALPHA)*exp(y)/exp(h);
exp(la)=BETA*exp(la(+1))*(ALPHA*exp(y(+1))/exp(k)+1-DELTA);
exp(la)=BETA*exp(la(+1))*(1+exp(r));
exp(y) = exp(c) + exp(ii) + exp(g) ;
exp(k)=(1-DELTA)*exp(k(-1))+exp(ii);
exp(y)=exp(a)*(exp(k(-1)))^ALPHA*(exp(h))^(1-ALPHA);
log(exp(a)/a_ss) = RHO_a*log(exp(a(-1))/a_ss) + u_a;
log(exp(g)/g_ss) = RHO_g*log(exp(g(-1))/g_ss) + u_g;
end;
%----------------------------------------------------------------
% 4. Steady State
%----------------------------------------------------------------
steady_state_model;
// Computing the steady state and calibrated parameters
BETA=1/(1+r_ss);
y_to_k_ss=(r_ss+DELTA)/(ALPHA);
k_to_h_ss=y_to_k_ss^(1/(ALPHA-1));
k_ss=k_to_h_ss*h_ss;
y_ss=y_to_k_ss*k_ss;
g_ss=g_to_y_ss*y_ss;
ii_ss=DELTA*k_ss;
c_ss=y_ss-ii_ss-g_ss;
OMEGA=(1-ALPHA)*y_ss/c_ss*(1/h_ss-1);
la_ss=c_ss^(-GAMMA)*(1-h_ss)^(OMEGA*(1-GAMMA));
// Initial values for solver
a=log(a_ss);
g=log(g_ss);
y=log(y_ss);
h=log(h_ss);
k=log(k_ss);
c=log(c_ss);
ii=log(ii_ss);
r=log(r_ss);
la=log(la_ss);
end;
%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------
steady;
check;
shocks;
var u_a = SIGMA_a^2;
var u_g = SIGMA_g^2;
end;
stoch_simul(periods=0, irf = 50, order = 1);
save rbc_loglinear.mat;
and it runs smoothly
But when I incoporate the search frictions i have real problems. I have tried to solve the steady state but i cant seem to solve the system. The code so far is this:
close all;
warning off ;
%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------
// Endogenous variables (15)
var C N K I Y LAM S V M A G R Q P THETA;
varexo u_A u_G;
parameters beta alpha gamma sigma co a eta phi psi delta; //(10)
parameters rho_A sigma_A rho_G sigma_G;
parameters G_ss A_ss G_to_Y_ss R_ss N_ss Q_ss;
%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------
alpha=0.33;
delta=0.023;
RHO_a=0.95;
SIGMA_a=0.01;
RHO_g=0.90;
SIGMA_g=0.01;
eta=1;
gamma=0.6;
co=0.005;
a=0.05;
psi=0.07;
phi=2;
// Targeted steady state values
A_ss=1;
G_to_Y_ss=0.1;
R_ss=0.04/4;
N_ss=0.95;
//Q_ss=0.75; //no tengo que targetear Q porque al targetear N ya targueteo M, debido a la funcion Cobb Douglas de M puedo despejar y que me quede V
%----------------------------------------------------------------
% 3. Model (14 equations)
%----------------------------------------------------------------
model;
exp(Y)=exp(C)+exp(I)+exp(G)+a*exp(V)+co*exp(S)^(eta)*(1-exp(N(-1))); //condicion de agregación ecuacion 1
exp(Y)=exp(A)*exp(K(-1))^(alpha)*exp(N(-1))^(1-alpha); //función de producción ecuacion 2
exp(K)=(1-delta)*exp(K(-1))+exp(I); //ley de movimiento del capital ecuacion 3
exp(N)=(1-psi)*exp(N(-1))+exp(M); //ley de movimiento del empleo ecuacion 4
exp(M)=exp(V)^(gamma)*(exp(S)*(1-exp(N(-1))))^(gamma); //funcion de matching ecuacion 5
exp(C)^(-sigma)=exp(LAM); //CPO con respecto al consumo ecuacion 6
exp(LAM)=beta*exp(LAM(+1))*(alpha*exp(Y(+1))/exp(K)+1-delta); //condicion respecto a la acumulación de capital ecuación 7
exp(LAM)=beta*exp(LAM(+1))*(1+exp(R)); //es lo mismo que la anterior solo que con R
exp(LAM)*((-1)*co*eta*exp(S)^(eta-1)*(1-exp(N(-1))))+beta*((-1)*(exp(N)^(phi))*gamma*exp(M)/exp(S)+exp(LAM(+1))*((1-alpha)*(exp(Y(+1))/exp(N))*gamma*exp(M)/exp(S)+co*exp(S(+1))^(eta)*gamma*(exp(M)/exp(S))))=0; //CPO con respecto a search ecuacion 8
exp(LAM)*((-1)*a)+beta*(-(exp(N)^(phi))*(1-gamma)*exp(M)/exp(V)+exp(LAM(+1))*((1-alpha)*(exp(Y(+1))/exp(N))*(1-gamma)*exp(M)/exp(V)+co*exp(S(+1))*(1-gamma)*exp(M)/exp(V)))=0; //cpo con respecto a las vacantes ecuacion 9
exp(Q)=exp(M)/exp(V); //probabilidad q ecuacion 12
exp(P)=exp(M)/(exp(S)*(1-exp(N(-1)))); //probabilidad p ecuacion 13
exp(THETA)=exp(V)/(1-exp(N(-1))); //tightness of labour market ecuacion 14
log(exp(A)/A_ss) = rho_A*log(exp(A(-1))/A_ss) + u_A; //proceso ar1 para la tecnologia ecuacion 10
log(exp(G)/G_ss) = rho_G*log(exp(G(-1))/G_ss) + u_G; //proceso ar1 para el gasto del gobierno ecuacion 11
end;
%----------------------------------------------------------------
% 4. Steady State
%----------------------------------------------------------------
steady_state_model;
beta=1/(1+R_ss);
Y_to_K_ss=(R_ss+delta)/(alpha);
K_to_N_ss=Y_to_K_ss^(1/(alpha-1));
K_ss=K_to_N_ss*N_ss;
Y_ss=Y_to_K_ss*K_ss;
G_ss=G_to_Y_ss*Y_ss;
I_ss=delta*K_ss;
C_ss=Y_ss-I_ss-G_ss;
LAM_ss=C_ss^(-sigma);
M_ss=N_ss*psi;
//M_ss=V_ss^(1-gamma)*S_ss^(gamma)*(1-N_ss)^(gamma);
//P_ss=M_ss/(S_ss*(1-N_ss));
//Q_ss=M_ss/V_ss;
//V_ss=M_ss/Q_ss;
S_ss=beta*M_ss*gamma*(co^(-1))*((LAM_ss)^(-1))*(N_ss^(phi)-LAM_ss*(Y_ss/N_ss)*(1-alpha))*(beta*M_ss-eta*(1-N_ss))^(-1);
V_ss=(N_ss*psi*((S_ss*(1-N_ss))^(-gamma)))^(1/(1-gamma));
Q_ss=M_ss/V_ss;
P_ss=M_ss/(S_ss*(1-N_ss));
THETA_ss=V_ss/(1-N_ss);
// Initial values for solver
A=log(A_ss);
G=log(G_ss);
Y=log(Y_ss);
N=log(N_ss);
K=log(K_ss);
C=log(C_ss);
I=log(I_ss);
R=log(R_ss);
LAM=log(LAM_ss);
V=log(V_ss);
S=log(S_ss);
Q=log(Q_ss);
P=log(P_ss);
end;
%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------
steady;
check;
shocks;
var u_A = SIGMA_A^2;
var u_G = SIGMA_G^2;
end;
stoch_simul(periods=0, irf = 50, order = 1);
save searchRBC.mat;
When I run it Dynare cant solve the steady state. Any suggestions will be appreciated. Does anyone know of an example of search frictions? I did not find one in the paper section of Dynare.
Thanks