Kaplan and Menzio's shopping time model is a search&matching unemployment model where we, for a steady state equilibrium, need to determine to variables:
- $J$: Value of a worker
- $u$: unemployment rate
Their steady state values ($\dot J, \dot u = 0$) are given by the following system of equations:
$$ J = \frac{(1-\gamma)(S(u) + y_e - y_u)}{\rho + \delta}\\ u = \frac{\delta}{\delta + \lambda(J)} $$
Furthermore, "profits from the good with price dispersion" and wages, respectively, are given by (equations (6), (7) on page 12)
$$ S(u) = A(u) + B(u)*w(u)\\ w(u) = y_u + \gamma*(S(u) + y_e - y_u) $$
Where $A(u), B(u)$ are some placeholders for a bunch of constants and parameters, that may depend on $u$. I plug out the wages and solve as
$$ \tilde S(u) = \frac{A(u) + B(u)(y_u + \gamma(y_e - y_u)}{1 - B(u)\gamma} $$
Then, using the authors' calibration and this version of $\tilde S(u)$, I can solve for both $J$ and $u$. Here it is:
Given their calibration, they get two interesting steady state equilibria on the $(u, J)$ space: $(0.053, 11.3)$ and $(0.081, 9.5)$. My $u(J)$ graph seems to be correct as it goes through both these loci. The $J(u)$ line, however, seems to be "too small" given $u$.
The only object somewhat difficult to compute is $S(u)$. I have verified that my step of replacing actually works: I computed $w(u)$ using $\tilde S(u)$ and verified that $S(u, w(u)) == \tilde S(u)$ (up to a numerical approximation).
I am not asking for someone to find my mistake, but rather where to look for it: I have checked anything I could come up with and am somewhat stuck. For the interested, here is my Python code:
# solves simple shopping time model
# only on the steady state equilibria
import numpy as np
import matplotlib.pyplot as plt
# all parameters for monthly
class Parameters(object):
def __init__(self):
self.psi_u = 0.27 # search twice, unemployed
self.psi_e = 0.02 # search twice, employed < psi_u
self.gamma = 0.74 # bargaining power
self.alpha = 1 # BJ exponent in utility
self.r = 15.7 # reservation price, home transformation
self.c = 1 # production technology firm
self.y_u = 4.91 # efficiency home
self.y_e = 1 # efficiency firm
self.rho = 0.003 # depreciation rate
self.delta = 0.024 # separation rate
self.phi = 1.24 # matching function efficiency
self.k = 8.02 # search costs of labor for firm
def b(u, Param):
return 1 + Param.psi_e + u*(Param.psi_u - Param.psi_e)
def s(u, Param):
return 1 - u
def sigma(u, Param):
return s(u, Param)/b(u, Param)
# seller meets buyer
def muOfU(u, Param):
return np.minimum(1/sigma(u, Param), 1)
# buyer meets seller
def nuOfU(u, Param):
return np.minimum(sigma(u, Param), 1)
def lambdaOfJ(J, Param):
result = ( ((J/Param.k)**(Param.phi) - 1 )**(-1) + 1 )**(-float(1)/Param.phi)
result[np.isnan(result)] = 0
return result
# not needed atm, replaced within lambdaOfJ (instead of lambdaOfTheta)
def thetaOfJ(J, Param):
#eta(theta)J = k
#etaInverse = (eta^(-phi) - 1)^(1/phi)
x = Param.k/J
return (x**(-Param.phi) - 1)**(1/Param.phi)
def STilde(u, Param):
A1 = muOfU(u, Param)*u*(1+Param.psi_u)/b(u, Param)
A2 = 1 - 2*Param.psi_u*nuOfU(u, Param)/(1+Param.psi_u)
A3 = Param.alpha*Param.y_u*(Param.r-Param.c)/Param.r
A = A1*A2*A3
B1 = muOfU(u, Param)*(1-u)*(1+Param.psi_e)/b(u, Param)
B2 = 1 - 2*Param.psi_e*nuOfU(u, Param)/(1+Param.psi_e)
B3 = Param.alpha*(Param.r-Param.c)/Param.r
B = B1*B2*B3
result = (A + B*(Param.y_u + Param.gamma*(Param.y_e - Param.y_u) ))/(1 - B*Param.gamma)
return result
def S(u, wages, Param):
A1 = muOfU(u, Param)*u*(1+Param.psi_u)/b(u, Param)
A2 = 1 - 2*Param.psi_u*nuOfU(u, Param)/(1+Param.psi_u)
A3 = Param.alpha*Param.y_u*(Param.r-Param.c)/Param.r
A = A1*A2*A3
B1 = muOfU(u, Param)*(1-u)*(1+Param.psi_e)/b(u, Param)
B2 = 1 - 2*Param.psi_e*nuOfU(u, Param)/(1+Param.psi_e)
B3 = Param.alpha*(Param.r-Param.c)/Param.r
B = B1*B2*B3
result = A + B*wages
return result
def w(u, Param):
return Param.y_u + Param.gamma*(STilde(u, Param) + Param.y_e - Param.y_u)
#result2 = A + B*w(u, Param)
def JSteadyState(u, Param):
A = (1-Param.gamma)*(STilde(u, Param) + Param.y_e - Param.y_u )
B = Param.rho + Param.delta
return A/B
def uSteadyState(J, Param):
B = Param.delta + lambdaOfJ(J, Param)
return Param.delta/B
Param = Parameters()
# compute J(u) and u(J)
uGrid = np.linspace(0.001, 0.2, 100)
J = JSteadyState(uGrid, Param)
JGrid = np.linspace(5, 20, 1000)
u = uSteadyState(JGrid, Param)
# verify computation of S(u)
# wages given STilde:
wages = w(uGrid, Param)
# S given u, STilde
SOriginal = S(uGrid, wages, Param)
SWithTilde = STilde(uGrid, Param)
print max(abs(SWithTilde - SOriginal)) # 8.881784197e-16
# plot J(u) and u(J)
plt.plot(u, JGrid, label='u(J)')
plt.plot(uGrid, J, label='J(u)')
plt.legend()
plt.xlabel('u')
plt.ylabel('J')
plt.show()