@@ -83,7 +83,7 @@ We solve this model using value function iteration.
83
83
Let's set up a ` namedtuple ` to store information needed to solve the model.
84
84
85
85
``` {code-cell} ipython3
86
- Model = namedtuple('Model', ('n', 'w_vals', 'P', 'β', 'c', 'θ' ))
86
+ Model = namedtuple('Model', ('n', 'w_vals', 'P', 'β', 'c'))
87
87
```
88
88
89
89
The function below holds default values and populates the namedtuple.
@@ -94,14 +94,13 @@ def create_js_model(
94
94
ρ=0.9, # wage persistence
95
95
ν=0.2, # wage volatility
96
96
β=0.99, # discount factor
97
- c=1.0, # unemployment compensation
98
- θ=-0.1 # risk parameter
97
+ c=1.0 # unemployment compensation
99
98
):
100
99
"Creates an instance of the job search model with Markov wages."
101
100
mc = qe.tauchen(n, ρ, ν)
102
101
w_vals, P = jnp.exp(mc.state_values), mc.P
103
102
P = jnp.array(P)
104
- return Model(n, w_vals, P, β, c, θ )
103
+ return Model(n, w_vals, P, β, c)
105
104
```
106
105
107
106
Here's the Bellman operator.
@@ -115,7 +114,7 @@ def T(v, model):
115
114
e(w) = w / (1-β) and (Ev)(w) = E_w[ v(W')]
116
115
117
116
"""
118
- n, w_vals, P, β, c, θ = model
117
+ n, w_vals, P, β, c = model
119
118
h = c + β * P @ v
120
119
e = w_vals / (1 - β)
121
120
@@ -143,7 +142,7 @@ is higher than the value of continuing.
143
142
@jax.jit
144
143
def get_greedy(v, model):
145
144
"""Get a v-greedy policy."""
146
- n, w_vals, P, β, c, θ = model
145
+ n, w_vals, P, β, c = model
147
146
e = w_vals / (1 - β)
148
147
h = c + β * P @ v
149
148
σ = jnp.where(e >= h, 1, 0)
@@ -178,7 +177,7 @@ Let's set up and solve the model.
178
177
179
178
``` {code-cell} ipython3
180
179
model = create_js_model()
181
- n, w_vals, P, β, c, θ = model
180
+ n, w_vals, P, β, c = model
182
181
183
182
qe.tic()
184
183
v_star, σ_star = vfi(model)
@@ -240,6 +239,8 @@ Try to interpret your result.
240
239
```
241
240
242
241
``` {code-cell} ipython3
242
+ RiskModel = namedtuple('Model', ('n', 'w_vals', 'P', 'β', 'c', 'θ'))
243
+
243
244
def create_risk_sensitive_js_model(
244
245
n=500, # wage grid size
245
246
ρ=0.9, # wage persistence
@@ -252,7 +253,7 @@ def create_risk_sensitive_js_model(
252
253
mc = qe.tauchen(n, ρ, ν)
253
254
w_vals, P = jnp.exp(mc.state_values), mc.P
254
255
P = jnp.array(P)
255
- return Model (n, w_vals, P, β, c, θ)
256
+ return RiskModel (n, w_vals, P, β, c, θ)
256
257
257
258
258
259
@jax.jit
0 commit comments