Skip to content

Commit 2e0c9b2

Browse files
authored
Small fix to job search (#179)
* misc * misc
1 parent e767f4b commit 2e0c9b2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lectures/job_search.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ We solve this model using value function iteration.
8383
Let's set up a `namedtuple` to store information needed to solve the model.
8484

8585
```{code-cell} ipython3
86-
Model = namedtuple('Model', ('n', 'w_vals', 'P', 'β', 'c', 'θ'))
86+
Model = namedtuple('Model', ('n', 'w_vals', 'P', 'β', 'c'))
8787
```
8888

8989
The function below holds default values and populates the namedtuple.
@@ -94,14 +94,13 @@ def create_js_model(
9494
ρ=0.9, # wage persistence
9595
ν=0.2, # wage volatility
9696
β=0.99, # discount factor
97-
c=1.0, # unemployment compensation
98-
θ=-0.1 # risk parameter
97+
c=1.0 # unemployment compensation
9998
):
10099
"Creates an instance of the job search model with Markov wages."
101100
mc = qe.tauchen(n, ρ, ν)
102101
w_vals, P = jnp.exp(mc.state_values), mc.P
103102
P = jnp.array(P)
104-
return Model(n, w_vals, P, β, c, θ)
103+
return Model(n, w_vals, P, β, c)
105104
```
106105

107106
Here's the Bellman operator.
@@ -115,7 +114,7 @@ def T(v, model):
115114
e(w) = w / (1-β) and (Ev)(w) = E_w[ v(W')]
116115
117116
"""
118-
n, w_vals, P, β, c, θ = model
117+
n, w_vals, P, β, c = model
119118
h = c + β * P @ v
120119
e = w_vals / (1 - β)
121120
@@ -143,7 +142,7 @@ is higher than the value of continuing.
143142
@jax.jit
144143
def get_greedy(v, model):
145144
"""Get a v-greedy policy."""
146-
n, w_vals, P, β, c, θ = model
145+
n, w_vals, P, β, c = model
147146
e = w_vals / (1 - β)
148147
h = c + β * P @ v
149148
σ = jnp.where(e >= h, 1, 0)
@@ -178,7 +177,7 @@ Let's set up and solve the model.
178177

179178
```{code-cell} ipython3
180179
model = create_js_model()
181-
n, w_vals, P, β, c, θ = model
180+
n, w_vals, P, β, c = model
182181
183182
qe.tic()
184183
v_star, σ_star = vfi(model)
@@ -240,6 +239,8 @@ Try to interpret your result.
240239
```
241240

242241
```{code-cell} ipython3
242+
RiskModel = namedtuple('Model', ('n', 'w_vals', 'P', 'β', 'c', 'θ'))
243+
243244
def create_risk_sensitive_js_model(
244245
n=500, # wage grid size
245246
ρ=0.9, # wage persistence
@@ -252,7 +253,7 @@ def create_risk_sensitive_js_model(
252253
mc = qe.tauchen(n, ρ, ν)
253254
w_vals, P = jnp.exp(mc.state_values), mc.P
254255
P = jnp.array(P)
255-
return Model(n, w_vals, P, β, c, θ)
256+
return RiskModel(n, w_vals, P, β, c, θ)
256257
257258
258259
@jax.jit

0 commit comments

Comments
 (0)