From 77c8ea40ea8fef6e5c24b891aeba45793f678a38 Mon Sep 17 00:00:00 2001 From: John Stachurski Date: Thu, 13 Nov 2025 07:52:16 +0900 Subject: [PATCH 1/2] misc --- lectures/mccall_model_with_separation.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lectures/mccall_model_with_separation.md b/lectures/mccall_model_with_separation.md index 612e1a290..391786692 100644 --- a/lectures/mccall_model_with_separation.md +++ b/lectures/mccall_model_with_separation.md @@ -467,17 +467,18 @@ Here's a function `compute_reservation_wage` that takes an instance of `Model` and returns the associated reservation wage. ```{code-cell} ipython3 -@jax.jit def compute_reservation_wage(model): """ Computes the reservation wage of an instance of the McCall model - by finding the smallest w such that v_e(w) >= h. If no such w exists, then - w_bar is set to np.inf. - """ + by finding the smallest w such that v_e(w) >= h. + """ + # Find the first i such that v_e(w_i) >= h and return w_vals[i] + # If no such w exists, then w_bar is set to np.inf v_e, h = solve_model(model) - i = jnp.searchsorted(v_e, h, side='left') - w_bar = jnp.where(i >= len(model.w), jnp.inf, model.w[i]) + accept = v_e >= h + i = jnp.argmax(accept) # take first accept index + w_bar = jnp.where(jnp.any(accept), w_vals[i], jnp.inf) return w_bar ``` From 78898325c72f12e57fd72d2a4843e463c9198daa Mon Sep 17 00:00:00 2001 From: John Stachurski Date: Thu, 13 Nov 2025 08:09:14 +0900 Subject: [PATCH 2/2] misc --- lectures/mccall_model_with_separation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/mccall_model_with_separation.md b/lectures/mccall_model_with_separation.md index 391786692..1da6cccca 100644 --- a/lectures/mccall_model_with_separation.md +++ b/lectures/mccall_model_with_separation.md @@ -473,12 +473,12 @@ def compute_reservation_wage(model): by finding the smallest w such that v_e(w) >= h. """ - # Find the first i such that v_e(w_i) >= h and return w_vals[i] + # Find the first i such that v_e(w_i) >= h and return w[i] # If no such w exists, then w_bar is set to np.inf v_e, h = solve_model(model) accept = v_e >= h i = jnp.argmax(accept) # take first accept index - w_bar = jnp.where(jnp.any(accept), w_vals[i], jnp.inf) + w_bar = jnp.where(jnp.any(accept), model.w[i], jnp.inf) return w_bar ```