File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -467,17 +467,18 @@ Here's a function `compute_reservation_wage` that takes an instance of `Model`
467467and returns the associated reservation wage.
468468
469469``` {code-cell} ipython3
470- @jax.jit
471470def compute_reservation_wage(model):
472471 """
473472 Computes the reservation wage of an instance of the McCall model
474- by finding the smallest w such that v_e(w) >= h. If no such w exists, then
475- w_bar is set to np.inf.
476- """
473+ by finding the smallest w such that v_e(w) >= h.
477474
475+ """
476+ # Find the first i such that v_e(w_i) >= h and return w[i]
477+ # If no such w exists, then w_bar is set to np.inf
478478 v_e, h = solve_model(model)
479- i = jnp.searchsorted(v_e, h, side='left')
480- w_bar = jnp.where(i >= len(model.w), jnp.inf, model.w[i])
479+ accept = v_e >= h
480+ i = jnp.argmax(accept) # take first accept index
481+ w_bar = jnp.where(jnp.any(accept), model.w[i], jnp.inf)
481482 return w_bar
482483```
483484
You can’t perform that action at this time.
0 commit comments