Skip to content

Commit 0503f6d

Browse files
committed
misc
1 parent 848e7f1 commit 0503f6d

File tree

1 file changed

+122
-96
lines changed

1 file changed

+122
-96
lines changed

lectures/endogenous_lake.md

Lines changed: 122 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,15 @@ In addition to what's in Anaconda, this lecture will need the following librarie
4141

4242
This lecture is a continuation of the {doc}`lake model lecture <lake_model>`.
4343

44-
We strongly recommend you read that lecture first before proceeding with this one.
44+
We recommend you read that lecture first before proceeding with this one.
4545

46-
In the previous lecture, we studied a lake model of unemployment and employment where the transition rates between states were exogenous parameters.
46+
In the previous lecture, we studied a lake model of unemployment and employment
47+
where the transition rates between states were exogenous parameters.
4748

4849
In this lecture, we extend the model by making the job finding rate endogenous.
4950

5051
Specifically, the transition rate from unemployment to employment will be determined by the McCall search model {cite}`McCall1970`.
5152

52-
All details relevant to the following discussion can be found in {doc}`our treatment <mccall_model>` of that model.
53-
5453
Let's start with some imports:
5554

5655
```{code-cell} ipython3
@@ -63,107 +62,56 @@ from functools import partial
6362
import jax.scipy.stats as stats
6463
```
6564

66-
## Endogenous job finding rate
6765

68-
We now make the hiring rate endogenous.
6966

70-
The transition rate from unemployment to employment will be determined by the McCall search model {cite}`McCall1970`.
7167

72-
All details relevant to the following discussion can be found in {doc}`our treatment <mccall_model>` of that model.
68+
## Set Up
69+
70+
The basic structure of the model will be as discussed in the {doc}`lake model lecture <lake_model>`.
71+
72+
The only difference is that the hiring rate is endogenous, determined by the
73+
decisions of optimizing agents inhabiting a McCall search model {cite}`McCall1970` with
74+
IID wage offers and job separation at rate $\alpha$.
75+
7376

7477
### Reservation wage
7578

76-
The most important thing to remember about the model is that optimal decisions
77-
are characterized by a reservation wage $\bar w$
79+
In the model, the optimal policy is characterized by a reservation wage $\bar w$
7880

7981
* If the wage offer $w$ in hand is greater than or equal to $\bar w$, then the worker accepts.
8082
* Otherwise, the worker rejects.
8183

82-
As we saw in {doc}`our discussion of the model <mccall_model>`, the reservation wage depends on the wage offer distribution and the parameters
84+
The reservation wage depends on the wage offer distribution and the parameters
8385

8486
* $\alpha$, the separation rate
8587
* $\beta$, the discount factor
8688
* $\gamma$, the offer arrival rate
8789
* $c$, unemployment compensation
8890

89-
### Linking the McCall search model to the lake model
90-
91-
Suppose that all workers inside a lake model behave according to the McCall search model.
92-
93-
The exogenous probability of leaving employment remains $\alpha$.
94-
95-
But their optimal decision rules determine the probability $\lambda$ of leaving unemployment.
96-
97-
This is now
98-
99-
```{math}
100-
:label: lake_lamda
101-
102-
\lambda
103-
= \gamma \mathbb P \{ w_t \geq \bar w\}
104-
= \gamma \sum_{w' \geq \bar w} p(w')
105-
```
106-
107-
### Fiscal policy
108-
109-
We can use the McCall search version of the Lake Model to find an optimal level of unemployment insurance.
110-
111-
We assume that the government sets unemployment compensation $c$.
112-
113-
The government imposes a lump-sum tax $\tau$ sufficient to finance total unemployment payments.
114-
115-
To attain a balanced budget at a steady state, taxes, the steady state unemployment rate $u$, and the unemployment compensation rate must satisfy
116-
117-
$$
118-
\tau = u c
119-
$$
120-
121-
The lump-sum tax applies to everyone, including unemployed workers.
122-
123-
Thus, the post-tax income of an employed worker with wage $w$ is $w - \tau$.
124-
125-
The post-tax income of an unemployed worker is $c - \tau$.
126-
127-
For each specification $(c, \tau)$ of government policy, we can solve for the worker's optimal reservation wage.
128-
129-
This determines $\lambda$ via {eq}`lake_lamda` evaluated at post tax wages, which in turn determines a steady state unemployment rate $u(c, \tau)$.
130-
131-
For a given level of unemployment benefit $c$, we can solve for a tax that balances the budget in the steady state
132-
133-
$$
134-
\tau = u(c, \tau) c
135-
$$
136-
137-
To evaluate alternative government tax-unemployment compensation pairs, we require a welfare criterion.
138-
139-
We use a steady state welfare criterion
140-
141-
$$
142-
W := e \, {\mathbb E} [V \, | \, \text{employed}] + u \, U
143-
$$
144-
145-
where the notation $V$ and $U$ is as defined in the {doc}`McCall search model lecture <mccall_model>`.
14691

14792
The wage offer distribution will be a discretized version of the lognormal distribution $LN(\log(20),1)$.
14893

14994
We first define a function to create a discretized wage distribution:
15095

15196
```{code-cell} ipython3
152-
def create_wage_distribution(max_wage: float,
153-
wage_grid_size: int,
154-
log_wage_mean: float):
155-
"""Create wage distribution"""
156-
w_vec_temp = jnp.linspace(1e-8, max_wage,
157-
wage_grid_size + 1)
158-
cdf = stats.norm.cdf(jnp.log(w_vec_temp),
159-
loc=jnp.log(log_wage_mean), scale=1)
97+
def create_wage_distribution(
98+
max_wage: float,
99+
wage_grid_size: int,
100+
log_wage_mean: float
101+
):
102+
w_vec_temp = jnp.linspace(
103+
1e-8, max_wage, wage_grid_size + 1
104+
)
105+
cdf = stats.norm.cdf(
106+
jnp.log(w_vec_temp), loc=jnp.log(log_wage_mean), scale=1
107+
)
160108
pdf = cdf[1:] - cdf[:-1]
161109
p_vec = pdf / pdf.sum()
162110
w_vec = (w_vec_temp[1:] + w_vec_temp[:-1]) / 2
163111
return w_vec, p_vec
164112
```
165113

166-
Let's create a wage distribution and visualize it:
114+
To illustrate the code, let's create a wage distribution and visualize it:
167115

168116
```{code-cell} ipython3
169117
w_vec, p_vec = create_wage_distribution(170, 200, 20)
@@ -176,14 +124,10 @@ plt.tight_layout()
176124
plt.show()
177125
```
178126

179-
### Fiscal policy code
180-
181-
We will make use of techniques from the {doc}`McCall model lecture <mccall_model>`.
182127

183-
First, we define the utility function and the McCall model data structure:
128+
Now we define the utility function and the McCall model data structure:
184129

185130
```{code-cell} ipython3
186-
@jax.jit
187131
def u(c, σ=2.0):
188132
return jnp.where(c > 0, (c**(1 - σ) - 1) / (1 - σ), -10e6)
189133
@@ -201,27 +145,27 @@ class McCallModel(NamedTuple):
201145
p_vec: jnp.ndarray # Probabilities over w_vec
202146
203147
204-
def create_mccall_model(α=0.2, β=0.98, γ=0.7, c=6.0, σ=2.0,
205-
w_vec=None, p_vec=None) -> McCallModel:
206-
"""
207-
Create a McCallModel.
208-
"""
148+
def create_mccall_model(
149+
α=0.2, β=0.98, γ=0.7, c=6.0, σ=2.0,
150+
w_vec=None,
151+
p_vec=None
152+
) -> McCallModel:
209153
if w_vec is None:
210154
n = 60 # Number of possible outcomes for wage
211-
212155
# Wages between 10 and 20
213156
w_vec = jnp.linspace(10, 20, n)
214157
a, b = 600, 400 # Shape parameters
215158
dist = BetaBinomial(n-1, a, b)
216159
p_vec = jnp.array(dist.pdf())
217-
return McCallModel(α=α, β=β, γ=γ, c=c, σ=σ, w_vec=w_vec, p_vec=p_vec)
160+
return McCallModel(
161+
α=α, β=β, γ=γ, c=c, σ=σ, w_vec=w_vec, p_vec=p_vec
162+
)
218163
```
219164

220-
Next, we implement the Bellman equation operator:
165+
Next, we implement the Bellman operator
221166

222167
```{code-cell} ipython3
223-
@jax.jit
224-
def bellman(mcm: McCallModel, V, U):
168+
def T(mcm: McCallModel, V, U):
225169
"""
226170
Update the Bellman equations.
227171
"""
@@ -234,7 +178,9 @@ def bellman(mcm: McCallModel, V, U):
234178
return V_new, U_new
235179
```
236180

237-
Now we define the value function iteration solver:
181+
Now we define the value function iteration solver.
182+
183+
We'll use a compiled while loop for extra speed.
238184

239185
```{code-cell} ipython3
240186
@jax.jit
@@ -248,7 +194,7 @@ def solve_mccall_model(mcm: McCallModel, tol=1e-5, max_iter=2000):
248194
249195
def body_fun(state):
250196
V, U, i, error = state
251-
V_new, U_new = bellman(mcm, V, U)
197+
V_new, U_new = T(mcm, V, U)
252198
error_1 = jnp.max(jnp.abs(V_new - V))
253199
error_2 = jnp.abs(U_new - U)
254200
error_new = jnp.maximum(error_1, error_2)
@@ -262,11 +208,15 @@ def solve_mccall_model(mcm: McCallModel, tol=1e-5, max_iter=2000):
262208
263209
init_state = (V_init, U_init, i_init, error_init)
264210
V_final, U_final, _, _ = jax.lax.while_loop(
265-
cond_fun, body_fun, init_state)
266-
211+
cond_fun, body_fun, init_state
212+
)
267213
return V_final, U_final
268214
```
269215

216+
217+
218+
### Lake model code
219+
270220
We also need the lake model functions from the previous lecture to compute steady state unemployment rates:
271221

272222
```{code-cell} ipython3
@@ -338,6 +288,82 @@ def rate_steady_state(model: LakeModel) -> jnp.ndarray:
338288
return steady_state
339289
```
340290

291+
292+
### Linking the McCall search model to the lake model
293+
294+
Suppose that all workers inside a lake model behave according to the McCall search model.
295+
296+
The exogenous probability of leaving employment remains $\alpha$.
297+
298+
But their optimal decision rules determine the probability $\lambda$ of leaving unemployment.
299+
300+
This is now
301+
302+
```{math}
303+
:label: lake_lamda
304+
305+
\lambda
306+
= \gamma \mathbb P \{ w_t \geq \bar w\}
307+
= \gamma \sum_{w' \geq \bar w} p(w')
308+
```
309+
310+
Here
311+
312+
* $\bar w$ is the reservation wage determined by the parameters and
313+
* $p$ is the wage offer distribution.
314+
315+
316+
317+
## Fiscal policy
318+
319+
In this section, we will put the lake model to work, examining outcomes
320+
associated with different levels of unemployment compensation.
321+
322+
Our aim is to find an optimal level of unemployment insurance.
323+
324+
We assume that the government sets unemployment compensation $c$.
325+
326+
The government imposes a lump-sum tax $\tau$ sufficient to finance total
327+
unemployment payments.
328+
329+
To attain a balanced budget at a steady state, taxes, the steady state
330+
unemployment rate $u$, and the unemployment compensation rate must satisfy
331+
332+
$$
333+
\tau = u c
334+
$$
335+
336+
The lump-sum tax applies to everyone, including unemployed workers.
337+
338+
* The post-tax income of an employed worker with wage $w$ is $w - \tau$.
339+
* The post-tax income of an unemployed worker is $c - \tau$.
340+
341+
For each specification $(c, \tau)$ of government policy, we can solve for the
342+
worker's optimal reservation wage.
343+
344+
This determines $\lambda$ via {eq}`lake_lamda` evaluated at post tax wages,
345+
which in turn determines a steady state unemployment rate $u(c, \tau)$.
346+
347+
For a given level of unemployment benefit $c$, we can solve for a tax that balances the budget in the steady state
348+
349+
$$
350+
\tau = u(c, \tau) c
351+
$$
352+
353+
To evaluate alternative government tax-unemployment compensation pairs, we require a welfare criterion.
354+
355+
We use a steady state welfare criterion
356+
357+
$$
358+
W := e \, {\mathbb E} [V \, | \, \text{employed}] + u \, U
359+
$$
360+
361+
where the notation $V$ and $U$ is as defined above and the expectation is at the
362+
steady state.
363+
364+
365+
366+
341367
### Computing optimal unemployment insurance
342368

343369
Now we set up the infrastructure to compute optimal unemployment insurance levels.

0 commit comments

Comments
 (0)