Skip to content

Commit 848e7f1

Browse files
jstacclaude
andcommitted
Add exercise to endogenous_lake.md lecture
Added an exercise exploring how the welfare-maximizing level of unemployment compensation varies with the job separation rate. **Exercise:** - Computes optimal unemployment compensation for different separation rates - Uses brute force search over c_vec to find welfare-maximizing c - Plots the relationship between α and optimal c - Includes economic interpretation of results **Solution shows:** - As separation rate increases, optimal unemployment insurance increases - Makes intuitive sense: more frequent job loss → higher value of insurance - Demonstrates practical application of the welfare optimization framework 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 16aca76 commit 848e7f1

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

lectures/endogenous_lake.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,3 +503,66 @@ plt.show()
503503
Welfare first increases and then decreases as unemployment benefits rise.
504504

505505
The level that maximizes steady state welfare is approximately 62.
506+
507+
## Exercises
508+
509+
```{exercise}
510+
:label: endogenous_lake_ex1
511+
512+
How does the welfare-maximizing level of unemployment compensation $c$ change with the job separation rate $\alpha$?
513+
514+
Compute and plot the optimal $c$ (the value that maximizes welfare) for a range of separation rates $\alpha$ from 0.01 to 0.025.
515+
516+
For each $\alpha$ value, find the optimal $c$ by computing welfare across the range of $c$ values and selecting the maximum.
517+
```
518+
519+
```{solution-start} endogenous_lake_ex1
520+
:class: dropdown
521+
```
522+
523+
Here is one solution:
524+
525+
```{code-cell} ipython3
526+
# Range of separation rates to explore
527+
α_values = jnp.linspace(0.01, 0.025, 15)
528+
529+
# We'll store the optimal c for each α
530+
optimal_c_values = []
531+
532+
for α_val in α_values:
533+
# Create economy parameters with this α
534+
params_α = create_economy_params(α=α_val)
535+
536+
# Create wage distribution
537+
w_vec_α, p_vec_α = create_wage_distribution(params_α.max_wage,
538+
params_α.wage_grid_size,
539+
params_α.log_wage_mean)
540+
541+
# Compute welfare for each c value
542+
welfare_values = []
543+
for c in c_vec:
544+
t = find_balanced_budget_tax(c, params_α, w_vec_α, p_vec_α)
545+
e_rate, u_rate, welfare = compute_steady_state_quantities(c, t, params_α,
546+
w_vec_α, p_vec_α)
547+
welfare_values.append(welfare)
548+
549+
# Find the c that maximizes welfare
550+
max_idx = jnp.argmax(jnp.array(welfare_values))
551+
optimal_c = c_vec[max_idx]
552+
optimal_c_values.append(optimal_c)
553+
554+
# Plot the relationship
555+
fig, ax = plt.subplots(figsize=(10, 6))
556+
ax.plot(α_values, optimal_c_values, lw=2, marker='o')
557+
ax.set_xlabel(r'Separation rate $\alpha$')
558+
ax.set_ylabel('Optimal unemployment compensation $c$')
559+
ax.set_title('How optimal unemployment insurance varies with job separation rate')
560+
ax.grid(True, alpha=0.3)
561+
plt.tight_layout()
562+
plt.show()
563+
```
564+
565+
We see that as the separation rate increases (workers lose their jobs more frequently), the welfare-maximizing level of unemployment compensation also increases. This makes intuitive sense: when job loss is more common, more generous unemployment insurance becomes more valuable for smoothing consumption and maintaining worker welfare.
566+
567+
```{solution-end}
568+
```

0 commit comments

Comments
 (0)