%Model Description++++++++++++++++++++++++++++++++++
This is Monica Merz's unemployment RBC model


%Model Information++++++++++++++++++++++++++++++++++
Name = Unemployment RBC Model;



%Parameters+++++++++++++++++++++++++++++++++++++++++
alpha    = 0.36;
betta    = 0.99;
delta    = 0.022;
eta      = 1.0;
ups      = -1.25;
lambdar  = 0.40;
mu       = 0.004;
rho_z    = 0.95;
psi      = 0.07;
a        = 0.05;
c0       = 0.005;
z_bar    = 1.0;
A_g      = 1.0;
sigma_z  = 0.007;


%Variable Vectors++++++++++++++++++++++++++++++++++++
[1]  k(t):capital{endo}[log,hp]
[2]  c(t):consumption{con}[log,hp]
[3]  y(t):output{con}[log,hp]
[4]  em(t):employment{endo}[log,hp]
[5]  ma(t):matches{con}[log,hp]
[6]  va(t):vacancies{con}[log,hp]
[7]  vac(t):vacancy_cost{con}[log,hp]
[8]  sic(t):search_cost{con}[log,hp]
[9]  si(t):search_intensity{con}[log,hp]
[10] inv(t):investment{con}[log,hp]
[11] r(t):real_rate{con}
[12] w(t):wage{con}[log,hp]
[13] z(t):epsz(t):productivity{exo}[log,hp]


%Boundary Conditions+++++++++++++++++++++++++++++++++
None


%Variable Substitution Non-Linear System+++++++++++++
# The utility function and its derivatives
[1]   @MU(t)     = LOG(c(t))+em(t-1)**(1-1/ups)/(1-1/ups);
[2]   @MU(t+1)   = FF_1{@MU(t)};
[1]   @MUc(t)    = DIFF{@MU(t),c(t)};
[2]   @MUc(t+1)  = DIFF{@MU(t+1),FF_1{c(t)}};
[2]   @MUc_bar   = SS{@MUc(t)};
[3]   @MUem(t)   = DIFF{@MU(t),em(t-1)};
[3]   @MUem(t+1) = FF_1{@MUem(t)};
[3]   @MUem_bar  = SS{@MUem(t)};
# The matching function and its derivatives
[3]   @MA(t)     = va(t)**(1-lambdar)*(si(t)*(1-em(t-1)))**lambdar;
[3]   @MA_bar    = SS{@MA(t)};
[4]   @MAv(t)    = (1-lambdar)*((si(t)*(1-em(t-1)))/va(t))**lambdar;
[5]   @MAv(t+1)  = FF_1{@MAv(t)};
[5]   @MAv_bar   = SS{@MAv(t)};
[4]   @MAem(t)   = -si(t)*lambdar*(va(t)/(si(t)*(1-em(t-1))))**(1-lambdar);
[5]   @MAem(t+1) = FF_1{@MAem(t)};
[4]   @MAem_bar  = SS{@MAem(t)};
[4]   @MAsi(t)   = (1-em(t-1))*lambdar*(va(t)/(si(t)*(1-em(t-1))))**(1-lambdar);
[5]   @MAsi(t+1) = FF_1{@MAsi(t)};
[4]   @MAsi_bar  = SS{@MAsi(t)};
# The production function and its derivatives
[6]   @F(t)      = z(t)*A_g*em(t-1)**(1-alpha)*k(t-1)**alpha;
[6]   @F_bar     = SS{@F(t)};
[6]   @Fn(t)     = DIFF{@F(t),em(t-1)};
[7]   @Fn(t+1)   = FF_1{@Fn(t)};
[6]   @Fn_bar    = SS{@Fn(t)};
[8]   @Fk(t)     = DIFF{@F(t),k(t-1)};
[9]   @Fk(t+1)   = FF_1{@Fk(t)};
[8]   @Fk_bar    = SS{@Fk(t)};
# The cost function for search intensity and its derivatives
[10]  @Cs(t)     = c0*si(t)**eta;
[10]  @Cs(t+1)   = FF_1{@Cs(t)};
[10]  @Cs_bar    = SS{@Cs(t)};
[11]  @Css(t)    = DIFF{@Cs(t),si(t)};
[11]  @Css(t+1)  = FF_1{@Css(t)};
[11]  @Css_bar   = SS{@Css(t)};


%Non-Linear First-Order Conditions+++++++++++++++++++

# Budget constraint, c(t)
[1]   c(t)+inv(t)+sic(t)+vac(t)-y(t) = 0;
# Search cost function, sic(t)
[2]   sic(t)-@Cs(t) = 0;
# Vacancy posting function, vac(t)
[3]   vac(t)-a*va(t) = 0;
# Definition for investment, inv(t)
[4]   inv(t)-k(t)+(1-delta)*k(t-1) = 0;
# Matching Cobb-Douglas function, ma(t)
[5]   ma(t)-@MA(t) = 0;
# Employment law of motion, em(t)
[6]   em(t)-(1-psi)*em(t-1)-ma(t) = 0;
# Defintion of aggregate output, y(t)
[7]   y(t)-@F(t) = 0;
# Law of motion of productivity shock, z(t)
[8]   (E(t)|z(t+1)/z(t)**rho_z)-epsz(t) = 0;
# Definition of the real rate of return on capital, r(t)
[9]   r(t)-1-@Fk(t)+delta = 0;
# Definition of the return on labour (i.e. wage rate), w(t)
[10]   w(t)-@Fn(t) = 0;
# Physical capital Euler equation, k(t)
[11]   betta*@MUc(t+1)*(1+@Fk(t+1)-delta)-@MUc(t) = 0;
# First-order condition with respect to vacancies, va(t)
[12]  (a*@MUc(t)/@MAv(t))-betta*(@MUc(t+1)*(@Fn(t+1)+@Cs(t+1))-@MUem(t+1)+...
      (a*@MUc(t+1)/@MAv(t+1))*((1-psi)+@MAem(t+1))) = 0;
# Eurler equation 3, si(t)
[13]  (@MUc(t)*@Css(t)*(1-em(t-1))/@MAsi(t))-betta*(@MUc(t+1)*(@Fn(t+1)+@Cs(t+1))-@MUem(t+1)+...
      (@MUc(t+1)*@Css(t+1)*(1-em(t))/@MAsi(t+1))*((1-psi)+@MAem(t+1))) = 0;


%Manual entry of sstate non-linear system++++++++++++
None


%Steady States [Closed Form]++++++++++++++++++++++++++

inv_bar = delta*k_bar;
vac_bar = a*va_bar;
r_bar   = 1-@Fk_bar+delta
y_bar   = @F_bar;
w_bar   = @Fn_bar;
sic_bar = @Cs_bar;
ma_bar  = @MA_bar;


%Steady State Non-Linear System [Manual]+++++++++++++

# Steady State budget constraint
[1]  @F_bar-c_bar-delta*k_bar-a*va_bar-@Cs_bar = 0;
# Steady state employment law of motion, i.e. steady state of matches in labour market
[2]  @MA_bar-psi*em_bar = 0;
# Physical capital Eurler steady state equation
[3]  @MUc_bar-betta*(@MUc_bar*(1+@Fk_bar-delta)) = 0;
# Vacancies Euler equation
[4]  (a*@MUc_bar/@MAv_bar)-betta*(@MUc_bar*(@Fn_bar+@Cs_bar)-@MUem_bar+...
     (a*@MUc_bar/@MAv_bar)*((1-psi)+@MAem_bar)) = 0;
# Search Intensity Euler equation
[5]  (@MUc_bar*@Css_bar*(1-em_bar)/@MAsi_bar)-betta*(@MUc_bar*(@Fn_bar+@Cs_bar)-...
      @MUem_bar+(@MUc_bar*@Css_bar*(1-em_bar)/@MAsi_bar)*((1-psi)+@MAem_bar)) = 0;

# For this model, sensible starting values are key to solving the steady state !
[1]  c_bar     = 2.0;
[2]  si_bar    = 0.01;
[3]  va_bar    = 0.01;
[4]  k_bar     = 12.0;
[5]  em_bar    = 0.3;


%Log-Linearized Model Equations++++++++++++++++++++++
None


%Variance-Covariance Matrix++++++++++++++++++++++++++
Sigma = [sigma_z**2];


%End Of Model File+++++++++++++++++++++++++++++++++++

