@@ -484,27 +484,37 @@ print(res_wage)
484484Now that we know how to compute the reservation wage, let's see how it varies with
485485parameters.
486486
487+ Here we compare the reservation wage at two values of $\beta$.
488+
489+ The reservation wages will be plotted alongside the wage offer distribution, so
490+ that we can get a sense of what fraction of offers will be accepted.
491+
487492``` {code-cell} ipython3
488- # Plot wage distribution with reservation wages before and after changing beta
489493fig, ax = plt.subplots()
490494
491495# Get the default color cycle
492496prop_cycle = plt.rcParams['axes.prop_cycle']
493497colors = prop_cycle.by_key()['color']
494498
495499# Plot the wage offer distribution
496- ax.plot(w, q, '-o', alpha=0.6, label='wage offer distribution', color=colors[0])
500+ ax.plot(w, q, '-', alpha=0.6, lw=2,
501+ label='wage offer distribution',
502+ color=colors[0])
497503
498504# Compute reservation wage with default beta
499505model_default = McCallModel()
500506v_init = model_default.w / (1 - model_default.β)
501- v_default, res_wage_default = compute_reservation_wage(model_default, v_init)
507+ v_default, res_wage_default = compute_reservation_wage(
508+ model_default, v_init
509+ )
502510
503511# Compute reservation wage with lower beta
504512β_new = 0.96
505513model_low_beta = McCallModel(β=β_new)
506514v_init_low = model_low_beta.w / (1 - model_low_beta.β)
507- v_low, res_wage_low = compute_reservation_wage(model_low_beta, v_init_low)
515+ v_low, res_wage_low = compute_reservation_wage(
516+ model_low_beta, v_init_low
517+ )
508518
509519# Plot vertical lines for reservation wages
510520ax.axvline(x=res_wage_default, color=colors[1], lw=2,
@@ -519,6 +529,10 @@ ax.legend(loc='upper left', frameon=False, fontsize=11)
519529plt.show()
520530```
521531
532+ We see that the reservation wage is higher when $\beta$ is higher.
533+
534+ This is not surprising, since higher $\beta$ is associated with more patience.
535+
522536Now let's look more systematically at what happens when we change $\beta$ and $c$.
523537
524538As a first step, given that we'll use it many times, let's create a more
@@ -655,7 +669,6 @@ The big difference here, however, is that we're iterating on a scalar $h$, rathe
655669Here's an implementation:
656670
657671``` {code-cell} ipython3
658- @jax.jit
659672def compute_reservation_wage_two(
660673 model: McCallModel, # instance containing default parameters
661674 tol: float=1e-5, # error tolerance
@@ -770,7 +783,6 @@ And here's a solution using JAX.
770783``` {code-cell} ipython3
771784cdf = jnp.cumsum(q_default)
772785
773- @jax.jit
774786def compute_stopping_time(w_bar, key):
775787 """
776788 Compute stopping time by drawing wages until one exceeds `w_bar`.
@@ -793,7 +805,6 @@ def compute_stopping_time(w_bar, key):
793805 return t_final
794806
795807
796- @partial(jax.jit, static_argnames=('num_reps',))
797808def compute_mean_stopping_time(w_bar, num_reps=100000, seed=1234):
798809 """
799810 Generate a mean stopping time over `num_reps` repetitions by
@@ -812,6 +823,7 @@ def compute_mean_stopping_time(w_bar, num_reps=100000, seed=1234):
812823
813824c_vals = jnp.linspace(10, 40, 25)
814825
826+ @jax.jit
815827def compute_stop_time_for_c(c):
816828 """Compute mean stopping time for a given compensation value c."""
817829 model = McCallModel(c=c)
0 commit comments