Skip to content

Commit f59c4bb

Browse files
committed
update exercises
1 parent 83b7d39 commit f59c4bb

File tree

1 file changed

+83
-58
lines changed

1 file changed

+83
-58
lines changed

lectures/mccall_model_with_separation.md

Lines changed: 83 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.17.2
7+
jupytext_version: 1.17.3
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
@@ -266,7 +266,6 @@ class Model(NamedTuple):
266266
q: jnp.ndarray = q_default # probabilities over wage offers
267267
```
268268

269-
270269
### Operators
271270

272271
We'll use a similar iterative approach to solving the Bellman equations that we
@@ -299,7 +298,6 @@ def T_e(model, v_u, v_e):
299298
return v_e_new
300299
```
301300

302-
303301
### Iteration
304302

305303
Now we write an iteration routine, which updates the pair of arrays $v_u$, $v_e$ until convergence.
@@ -335,8 +333,6 @@ def solve_full_model(
335333
return v_u, v_e
336334
```
337335

338-
339-
340336
### Computing the Reservation Wage
341337

342338
Now that we can solve for both value functions, let's investigate the reservation wage.
@@ -597,81 +593,38 @@ Next we will investigate how the reservation wage varies with parameters.
597593

598594
## Impact of Parameters
599595

600-
In each instance below, we'll show you a figure and then ask you to reproduce it in the exercises.
596+
In each instance below, we'll investigate how the reservation wage $\bar w$ varies
597+
with a particular parameter of interest, holding the other parameters fixed at their default values.
601598

602599
### The Reservation Wage and Unemployment Compensation
603600

604601
First, let's look at how $\bar w$ varies with unemployment compensation.
605602

606-
In the figure below, we use the default parameters in the `Model` class, apart from
607-
c (which takes the values given on the horizontal axis)
608-
609-
```{glue:figure} mccall_resw_c
610-
:figwidth: 600px
611-
612-
```
613-
614-
As expected, higher unemployment compensation causes the worker to hold out for higher wages.
615-
616-
In effect, the cost of continuing job search is reduced.
617-
618-
### The Reservation Wage and Discounting
619-
620-
Next, let's investigate how $\bar w$ varies with the discount factor.
621-
622-
The next figure plots the reservation wage associated with different values of
623-
$\beta$
624-
625-
```{glue:figure} mccall_resw_beta
626-
:figwidth: 600px
627-
628-
```
629-
630-
Again, the results are intuitive: More patient workers will hold out for higher wages.
631-
632-
### The Reservation Wage and Job Destruction
633-
634-
Finally, let's look at how $\bar w$ varies with the job separation rate $\alpha$.
635-
636-
Higher $\alpha$ translates to a greater chance that a worker will face termination in each period once employed.
637-
638-
```{glue:figure} mccall_resw_alpha
639-
:figwidth: 600px
640-
641-
```
642-
643-
Once more, the results are in line with our intuition.
644-
645-
If the separation rate is high, then the benefit of holding out for a higher wage falls.
646-
647-
Hence the reservation wage is lower.
648-
649-
## Exercises
603+
In the exercise below, we use the default parameters in the `Model` class, apart from
604+
$c$ (which takes the values given on the horizontal axis).
650605

651606
```{exercise-start}
652607
:label: mmws_ex1
653608
```
654609

655-
Reproduce all the reservation wage figures shown above.
610+
Generate a figure showing how $\bar w$ varies with unemployment compensation $c$.
656611

657-
Regarding the values on the horizontal axis, use
612+
Use the following values for unemployment compensation on the horizontal axis:
658613

659614
```{code-cell} ipython3
660615
grid_size = 25
661616
c_vals = jnp.linspace(2, 12, grid_size) # unemployment compensation
662-
β_vals = jnp.linspace(0.8, 0.99, grid_size) # discount factors
663-
α_vals = jnp.linspace(0.05, 0.5, grid_size) # separation rate
664617
```
665618

619+
Interpret the results.
620+
666621
```{exercise-end}
667622
```
668623

669624
```{solution-start} mmws_ex1
670625
:class: dropdown
671626
```
672627

673-
Here's the first figure.
674-
675628
```{code-cell} ipython3
676629
def compute_res_wage_given_c(c):
677630
model = Model(c=c)
@@ -688,7 +641,41 @@ glue("mccall_resw_c", fig, display=False)
688641
plt.show()
689642
```
690643

691-
Here's the second one.
644+
As expected, higher unemployment compensation causes the worker to hold out for higher wages.
645+
646+
In effect, the cost of continuing job search is reduced.
647+
648+
```{solution-end}
649+
```
650+
651+
### The Reservation Wage and Discounting
652+
653+
Next, let's investigate how $\bar w$ varies with the discount factor.
654+
655+
The next exercise considers the reservation wage associated with different values of
656+
$\beta$.
657+
658+
```{exercise-start}
659+
:label: mmws_ex2
660+
```
661+
662+
Generate a figure showing how $\bar w$ varies with the discount factor $\beta$.
663+
664+
Use the following values for the discount factor on the horizontal axis:
665+
666+
```{code-cell} ipython3
667+
grid_size = 25
668+
β_vals = jnp.linspace(0.8, 0.99, grid_size) # discount factors
669+
```
670+
671+
Interpret the results.
672+
673+
```{exercise-end}
674+
```
675+
676+
```{solution-start} mmws_ex2
677+
:class: dropdown
678+
```
692679

693680
```{code-cell} ipython3
694681
def compute_res_wage_given_beta(β):
@@ -706,7 +693,37 @@ glue("mccall_resw_beta", fig, display=False)
706693
plt.show()
707694
```
708695

709-
Here's the third.
696+
Again, the results are intuitive: More patient workers will hold out for higher wages.
697+
698+
699+
```{solution-end}
700+
```
701+
702+
### The Reservation Wage and Job Destruction
703+
704+
Finally, let's look at how $\bar w$ varies with the job separation rate $\alpha$.
705+
706+
Higher $\alpha$ translates to a greater chance that a worker will face termination in each period once employed.
707+
708+
```{exercise-start}
709+
:label: mmws_ex3
710+
```
711+
712+
Generate a figure showing how $\bar w$ varies with the separation rate $\alpha$.
713+
714+
Use the following values for the separation rate on the horizontal axis:
715+
716+
```{code-cell} ipython3
717+
grid_size = 25
718+
α_vals = jnp.linspace(0.05, 0.5, grid_size) # separation rate
719+
```
720+
721+
```{exercise-end}
722+
```
723+
724+
```{solution-start} mmws_ex3
725+
:class: dropdown
726+
```
710727

711728
```{code-cell} ipython3
712729
def compute_res_wage_given_alpha(α):
@@ -724,5 +741,13 @@ glue("mccall_resw_alpha", fig, display=False)
724741
plt.show()
725742
```
726743

744+
745+
Once more, the results are in line with our intuition.
746+
747+
If the separation rate is high, then the benefit of holding out for a higher wage falls.
748+
749+
Hence the reservation wage is lower.
750+
751+
727752
```{solution-end}
728753
```

0 commit comments

Comments
 (0)