# Decentralized Merz (1995)

Hi,

I am trying to integrate a matching function into a NK DSGE model with some financial frictions.
I wrote dynare code for the decentralized Merz (1995) model to represent the labor market frictions, which I then want to plug into the final DSGE. For some reason Dynare gives me this mistake:

Error using print_info (line 83)
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

When I run the S. Planners’ version with similar calibration - everything works perfect.
Maybe I’ve messed up with some equations, but unfortunately cannot spot the mistake so far.

I will be really grateful for any help!

Here is the code.

P.S. If you have a working bit of code on matching functions to put into NK DSGE - that might be even better:) Basically I just need to track the response of unemployment to some monetary shocks, sticky wages etc. are not necessary in this case.

Thank you in advance!

``````% The decentralized model of Merz (1995)
% In log deviations
% This .mod file sets cs and etas to fix search intensity

//endogenous variables
var varrho G p q r W C Y I S V M U Z K N y_dev u_dev v_dev;

//predetermined variables
predetermined_variables K N;

//exogenous variables
varexo e_Z;

//parameters
parameters lambda alpha rho cs etas cv etav delta_prime psi beta sig_e nu_est;

//initialize parameters
lambda=0.4;
alpha=0.36;
rho=0.95;
cs=0.00000000001;
etas=1000000000;
cv=0.05;
etav=1;
delta=0.022;
mu=0.004;
delta_prime=1-(1-delta)*(exp(-mu));
psi=0.07;
beta= 1/(1.04^(1/4));
nu_est=0.8;
sig_e=0.007;

//model equations
model;

//----------- Household -----------------------------------
// 1. Marginal Untility from Consumption
[varrho]
exp(varrho) = (1/exp(C));

// 2. Marginal Disutility from Work
[G]
exp(G)=exp(N)^(nu_est);

// 3. Consumption Euler equation
[C]
exp(varrho) =  beta*exp(varrho(+1))*(exp(r(+1))+1-delta_prime);

// 4. Search intensity Euler equation
[S]
//(1/exp(C))*cs=exp(P)*beta*((1/exp(C(+1)))*(W(+1)+cs)-exp(G(+1))+((1/exp(C(+1)))*cs/exp(P(+1)))*(1-psi-exp(P(+1))*S(+1)));

exp(varrho)*cs = exp(p)*beta*(exp(varrho(+1))*(W(+1)+cs)-exp(G(+1))+exp(varrho(+1))*cs/exp(p(+1))*(1-psi-exp(p(+1))*S(+1)));

//------------- Firm --------------------------------------
// 5. Production function
[Y]
exp(Y)=e`Preformatted text`xp(Z)*exp(K)^alpha*(exp(N))^(1-alpha);

// 6. Interest rate
[r]
exp( r)=alpha*exp(Y)/exp(K);

// 7. Vacancy creation Euler equation [cv - vacancy posting costs]
[V]
//(1/exp(C))*cv=(1-lambda)*exp(M)/exp(V)*beta*(1/exp(C(+1)))*((1-alpha)*exp(Y(+1))/exp(N(+1))-exp(W(+1))+(cv/((1-lambda)*exp(M(+1))/exp(V(+1))))*(1-psi));

exp(varrho) * cv = exp(q) * beta * exp(varrho(+1))*((1-alpha) * exp(Y(+1)) / exp(N(+1)) - exp(W(+1)) + (cv/exp(q(+1))) * (1-psi));

// 8. Wage
[W]
exp(W) = lambda*((1-alpha)*exp(Y)/exp(N)+cv*exp(V-U))+(1-lambda)*(exp(G)/exp(varrho)-cs);

// --------Equlibrium market clearing ----------------------
// 9. Aggregate Reource constraint
[I]
exp(Y)=exp( C)+exp(I)+cs*exp(S)^etas*exp(U)+cv*exp(V)^etav;

//----------Declarations------------------------------------

// 10. Unemployment
[U]
exp(U)=1-exp(N);

// 11. Matching function
[M]
exp(M)=(exp(V)^(1-lambda))*(exp(S+U))^lambda;

// 12. Kapital dynamics
[K]
exp(K(+1))=(1-delta_prime)*exp(K)+exp(I);

// 13. Labor dynamics
[N]
exp(N(+1))=(1-psi)*exp(N)+exp(M);

// 14. Probability of finding job
[p]
exp( p)=exp(M)/(exp(S+U));

//exp(P)=exp(M)/(exp(S)*exp(U));

// 15. Job match probability
[q]
exp(q)=(1-lambda)*exp(M)/exp(V);

// 16. Labor augmenting factor
[Z]
Z=rho*Z(-1)+e_Z;

// 17. Labor market tightness
//[theta]
//    exp(theta)=exp(V-U);

// 18. Avg.labor productivity
//[Pr]
//  exp(Pr)=exp(Y-N);

//--------- Cental Planner - [commented out] --------------
//MC of searching = MB from working
//    (cv*etav*exp(V)^(etav-1)/(exp(C)*(1-lambda)*exp(M-V)))=beta*((1/exp(C(+1)))*((1-alpha)*exp(Y(+1)-N(+1))+cs*exp(S(+1))^etas)-exp(N(+1))^(1/nu_est)+(cv*etav*exp(V(+1))^(etav-1)/(exp(C(+1))*(1-lambda)*exp(M(+1)-V(+1))))*(1-psi-lambda*exp(M(+1))/exp(U(+1))));

//MC of searching = MC of posting vacancies
//    (cs*etas*exp(S)^(etas)*exp(U)/((lambda)))=(cv*etav*exp(V)^(etav)/((1-lambda)));

//Labor market tightness
//    exp(theta)=exp(V-U);

//Budget constraint
//    exp(C)=exp(Y)-exp(I)-cs*exp(S)^etas*exp(U)-cv*exp(V)^etav;

// 16. Output deviation from St.St.
[y_dev]
y_dev = Y-STEADY_STATE(Y) ;

// 17. Unmployment deviation from St.St.
[u_dev]
u_dev = U-STEADY_STATE(U) ;

//18. Vacancy deviation from St.St.
[v_dev]
v_dev = V-STEADY_STATE(V) ;
end;

//initial values for parameters
initval;
W=0.8513;
G=-0.0688;
varrho=-0.9097;
r=-3.3298;
C=0.909695877517769;
Y=1.21297419220172;
I=-0.131035097064121;
S=7.88090800314440e-10;
V=-2.91164322016667;
M=-2.74529037907900;
U=-2.49576111823558;
p=-0.2495;
q=-0.3445;
Z=1;
K=3.52231558659806;
N=-0.0860303421462215;

//Pr=1.29900453434794;

y_dev=0;
u_dev=0;
v_dev=0;
end;

check;

//calculate steady state
steady;

//variance of shocks
shocks;
var e_Z=sig_e^2;
end;

stoch_simul(periods=2100);``````

I would recommend getting rid of the exp()-substitution. It makes steady state debugging too hard. My guess is that there is a problem related to incomplete substitution.
You may instead want to add auxiliary variables for the objects that interest you. See e.g.

Dear Prof. Pfeifer,

thank you for your advise.

It seems like the problem lays in the second part of the Wage equation (the one with 1-lambda part). If I set Gn/Uc to negative or give it ^(-1) power, the model works. So it seems like the model finds steady state only when I depreciate the HH take in the negotiation process. However, multiplying by a fixed coefficient worked only in the case when I set lambda to 0.95 and additionally multiplied by 0.2 (I was just guessing to see what was the problem), all the other combinations I’ve tried so far do not solve the issue.

Here is the updated code.

`````` //endogenous variables
var varrho r q G W C Y I S V M U Z K N p theta y_dev u_dev v_dev;

//predetermined variables
predetermined_variables K N;

//exogenous variables
varexo e_Z;

//parameters
parameters lambda alpha rho cs etas cv etav delta_prime psi beta sig_e nu_est;

//initialize parameters
lambda=0.4;   % weight of search effort and unemployed in matching function
alpha=0.36;   % weight of capital in production function
rho=0.95;     % persistence of technology shock
cs=0.005;    % search costs (c0)
etas=10;      % eta in search cost function
cv=0.05;      % vacancy posting costs
etav=1;       % curvature of vacancy posting costs (=1 linear costs)
delta=0.022;  % depreciation rate of capital
mu=0.004;     % growth rate
delta_prime=1-(1-delta)*(exp(-mu));
psi=0.07;     % constant separation rate
beta= 1/(1.04^(1/4));  % discount factor
nu_est=-1.25;  % Frisch elasticity
sig_e=0.007;  % standard devaition of shock

//model equations

model;
//----------- Household -----------------------------------

// 1. Marginal Untility from Consumption
[varrho]
exp(varrho) = (1/exp(C));

// 2. Marginal Disutility from Work
[G]
exp(G)=(exp(N)^(1/nu_est));

// 3. Consumption Euler equation
[C]
exp(varrho)=beta*(exp(varrho(+1))*(exp(r(+1))+1-delta_prime));

// 4. Search intensity Euler equation
[S]
exp(varrho)*cs=exp(p)*beta*(exp(varrho(+1))*(exp(W(+1))+cs)-exp(G(+1))+(exp(varrho(+1))*cs/exp(p(+1)))*(1+psi-exp(p(+1))*exp(S(+1))));

//------------- Firm --------------------------------------

// 5. Production function
[Y]
exp(Y)=exp(Z)*exp(K)^alpha*(exp(N))^(1-alpha);

// 6. Interest rate
[r]
exp(r)=alpha*exp(Y)/exp(K);

// 7. Vacancy creation Euler equation [cv - vacancy posting costs]
[V]
exp(varrho)*cv=exp(q)*beta*exp(varrho(+1))*((1-alpha)*exp(Y(+1))/exp(N(+1))-exp(W(+1))+(cv/exp(q(+1)))*(1-psi));

// 8. Wage
[W]
exp(W) = lambda*((1-alpha)*exp(Y)/exp(N)+cv*exp(V)/exp(U))+(1-lambda)*((exp(N)^(-1/nu_est))/exp(varrho)-cs);

// --------Equlibrium market clearing ----------------------

// 9. Aggregate Reource constraint
[I]
exp(Y)=exp(C)+exp(I)+cs*exp(S)^etas*exp(U)+cv*exp(V)^etav;

//----------Simplifictions------------------------------------

// 10. Unemployment
[U]
exp(U)=1-exp(N);

// 11. Matching function
[M]
exp(M)=exp(V)^(1-lambda)*(exp(S+U))^lambda;

// 12. Kapital dynamics
[K]
exp(K(+1))=(1-delta_prime)*exp(K)+exp(I);

// 13. Labor dynamics
[N]
exp(N(+1))=(1-psi)*exp(N)+exp(M);

// 14. Probability to find job
[P]
//exp(p)=exp(theta)^(1-lambda);

exp(p)=exp(M-S-U);

// 15. Job match probability
[q]
exp(q)=(1-lambda)*exp(M-V);

// 16. Labor augmenting factor
[Z]
Z=rho*Z(-1)+e_Z;

// 17. Output deviation from St.St.
[y_dev]
y_dev = Y-STEADY_STATE(Y) ;
// 18. Unmployment deviation from St.St.
[u_dev]
u_dev = U-STEADY_STATE(U) ;
//19. Vacancy deviation from St.St.
[v_dev]
v_dev = V-STEADY_STATE(V) ;
end;

//initial values for parameters
initval;

W=0.8513;
G=-0.0688;
varrho=-0.9097;
r=-3.3298;
C=0.909695877517769;
Y=1.21297419220172;
I=-0.131035097064121;
S=7.88090800314440e-10;
V=-2.91164322016667;
M=-2.74529037907900;
U=-2.49576111823558;
Z=0;
K=3.52231558659806;
N=-0.0860303421462215;
//P=1.29900453434794;
p=-0.2495;
q=-0.3445;
theta=-0.415882101931087;
y_dev=0;
u_dev=0;
v_dev=0;
end;

check;

//calculate steady state
steady;

//variance of shocks
shocks;
var e_Z=sig_e^2;
end;

stoch_simul(irf=120,order=1,hp_filter=1600, periods=2100);``````

I am not sure I understand. If you manipulate the mentioned equation, you get a steady state. Does that steady state make economic sense? Or do you just get some numbers due to counteracting a different problem hidden somewhere else in the model. What you describe suggests that your model equations still contain at least one mistake.