Skip to content

Commit 634af8a

Browse files
Improve lake (#179)
* Fix exercise environment and reference * Fix title * Finishe review * Fix headiing Capitalizations --------- Co-authored-by: HengCheng <[email protected]>
1 parent f3aa05e commit 634af8a

File tree

1 file changed

+79
-39
lines changed

1 file changed

+79
-39
lines changed

lectures/lake_model.md

Lines changed: 79 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ kernelspec:
1313

1414
# A Lake Model of Employment
1515

16+
## Outline
17+
1618
In addition to what's in Anaconda, this lecture will need the following libraries:
1719

1820
```{code-cell} ipython
@@ -30,7 +32,17 @@ to be installed on your computer. Installation instructions for graphviz can be
3032
```
3133

3234
This lecture studies a model of employment and unemployment flows in a large
33-
population.
35+
population called the **lake model**.
36+
37+
We will use the following imports in this lecture.
38+
39+
```{code-cell} ipython3
40+
import numpy as np
41+
import matplotlib.pyplot as plt
42+
from graphviz import Digraph
43+
```
44+
45+
## The Lake model
3446

3547
This model is sometimes called the **lake model** because there are two pools of workers:
3648

@@ -47,8 +59,6 @@ The "flows" between the two lakes are as follows:
4759
The below graph illustrates the lake model.
4860

4961
```{code-cell} ipython3
50-
from graphviz import Digraph
51-
5262
# Create Digraph object
5363
G = Digraph()
5464
G.attr(rankdir='LR')
@@ -70,39 +80,43 @@ G.edge('3', '3', label='(1-α)(1-d)')
7080
G
7181
```
7282

83+
## Dynamics
84+
7385
Let $e_t$ and $u_t$ be the number of employed and unemployed workers at time $t$ respectively.
7486

7587
The total population of workers is $n_t = e_t + u_t$.
7688

77-
The number of unemployed and employed workers thus evolve according to:
89+
The number of unemployed and employed workers thus evolves according to:
7890

7991
```{math}
8092
:label: lake_model
8193
\begin{aligned}
82-
u_{t+1} = (1-d)(1-\lambda)u_t + \alpha(1-d)e_t + bn_t = ((1-d)(1-\lambda) +& b)u_t + (\alpha(1-d) + b)e_t \\
83-
e_{t+1} = (1-d)\lambda u_t + (1 - \alpha)(1-d)e_t&
94+
u_{t+1} &= (1-d)(1-\lambda)u_t + \alpha(1-d)e_t + bn_t \\
95+
&= ((1-d)(1-\lambda) + b)u_t + (\alpha(1-d) + b)e_t \\
96+
e_{t+1} &= (1-d)\lambda u_t + (1 - \alpha)(1-d)e_t
8497
\end{aligned}
8598
```
8699

87-
We can arrange {eq}`lake_model` as a linear system of equations in matrix form $x_{t+1} = Ax_t$ such that:
100+
We can arrange {eq}`lake_model` as a linear system of equations in matrix form $x_{t+1} = Ax_t$ where
88101

89102
$$
90103
x_{t+1} =
91104
\begin{bmatrix}
92105
u_{t+1} \\
93106
e_{t+1}
94107
\end{bmatrix}
95-
, \; A =
108+
\quad
109+
A =
96110
\begin{bmatrix}
97111
(1-d)(1-\lambda) + b & \alpha(1-d) + b \\
98112
(1-d)\lambda & (1 - \alpha)(1-d)
99113
\end{bmatrix}
100-
\; \text{and} \;
114+
\quad \text{and} \quad
101115
x_t =
102116
\begin{bmatrix}
103117
u_t \\
104118
e_t
105-
\end{bmatrix}
119+
\end{bmatrix}.
106120
$$
107121

108122
Suppose at $t=0$ we have $x_0 = \begin{bmatrix} u_0 & e_0 \end{bmatrix}^\top$.
@@ -117,14 +131,9 @@ What long-run unemployment rate and employment rate should we expect?
117131

118132
Do long-run outcomes depend on the initial values $(u_0, e_o)$?
119133

120-
Let us first plot the time series of unemployment $u_t$, employment $e_t$, and labor force $n_t$.
121-
122-
We will use the following imports.
134+
### Visualising the long-run outcomes
123135

124-
```{code-cell} ipython3
125-
import numpy as np
126-
import matplotlib.pyplot as plt
127-
```
136+
Let us first plot the time series of unemployment $u_t$, employment $e_t$, and labor force $n_t$.
128137

129138
```{code-cell} ipython3
130139
class LakeModel:
@@ -216,7 +225,7 @@ plt.show()
216225

217226
Not surprisingly, we observe that labor force $n_t$ increases at a constant rate.
218227

219-
This conincides with the fact there is only one inflow source (new entrants pool) to unemployment and employment pools.
228+
This coincides with the fact there is only one inflow source (new entrants pool) to unemployment and employment pools.
220229

221230
The inflow and outflow of labor market system
222231
is determined by constant exit rate and entry rate of labor market in the long run.
@@ -226,19 +235,27 @@ In detail, let $\mathbb{1}=[1, 1]^\top$ be a vector of ones.
226235
Observe that
227236

228237
$$
229-
n_{t+1} = u_{t+1} + e_{t+1} = \mathbb{1}^\top x_t = \mathbb{1}^\top A x_t = (1 + b - d) (u_t + e_t) = (1 + b - d) n_t.
238+
\begin{aligned}
239+
n_{t+1} &= u_{t+1} + e_{t+1} \\
240+
&= \mathbb{1}^\top x_{t+1} \\
241+
&= \mathbb{1}^\top A x_t \\
242+
&= (1 + b - d) (u_t + e_t) \\
243+
&= (1 + b - d) n_t.
244+
\end{aligned}
230245
$$
231246

232247
Hence, the growth rate of $n_t$ is fixed at $1 + b - d$.
233248

234249
Moreover, the times series of unemployment and employment seems to grow at some stable rates in the long run.
235250

236-
Since by intuition if we consider unemployment pool and employment pool as a closed system, the growth should be similar the labor force.
251+
### The application of erron-Frobenius theorem
252+
253+
Since by intuition if we consider unemployment pool and employment pool as a closed system, the growth should be similar to the labor force.
237254

238255
We next ask whether the long run growth rates of $e_t$ and $u_t$
239256
also dominated by $1+b-d$ as labor force.
240257

241-
The answer will be clearer if we appeal to Perron-Frobenius theorem.
258+
The answer will be clearer if we appeal to {ref}`Perron-Frobenius theorem<perron-frobe>`.
242259

243260
The importance of the Perron-Frobenius theorem stems from the fact that
244261
firstly in the real world most matrices we encounter are nonnegative matrices.
@@ -250,6 +267,8 @@ $x_{t+1} = Ax_t$ or in short $x_t = A^tx_0$.
250267
This theorem helps characterise the dominant eigenvalue $r(A)$ which
251268
determines the behavior of this iterative process.
252269

270+
#### Dominant eigenvector
271+
253272
We now illustrate the power of the Perron-Frobenius theorem by showing how it
254273
helps us to analyze the lake model.
255274

@@ -261,7 +280,7 @@ $$
261280
r(A) := \max\{|\lambda|: \lambda \text{ is an eigenvalue of } A \}
262281
$$
263282

264-
- any other eigenvalue $\lambda$ in absolue value is strictly smaller than $r(A)$: $|\lambda|< r(A)$,
283+
- any other eigenvalue $\lambda$ in absolute value is strictly smaller than $r(A)$: $|\lambda|< r(A)$,
265284

266285
- there exist unique and everywhere positive right eigenvector $\phi$ (column vector) and left eigenvector $\psi$ (row vector):
267286

@@ -275,18 +294,18 @@ $$
275294
r(A)^{-t} A^t \to \phi \psi
276295
$$
277296

278-
The last statement implies that the magnitude of $A^t$ is identical to the magnitude of $r(A)^t$ in the long run, where $r(A)$ can be considered as the dominated eigenvalue in this lecture.
297+
The last statement implies that the magnitude of $A^t$ is identical to the magnitude of $r(A)^t$ in the long run, where $r(A)$ can be considered as the dominant eigenvalue in this lecture.
279298

280299
Therefore, the magnitude $x_t = A^t x_0$ is also dominated by $r(A)^t$ in the long run.
281300

282301
Recall that the spectral radius is bounded by column sums: for $A \geq 0$, we have
283302

284303
```{math}
285304
:label: PF_bounds
286-
\min_j colsum_j (A) \leq r(A) \leq \max_j colsum_j (A)
305+
\min_j \text{colsum}_j (A) \leq r(A) \leq \max_j \text{colsum}_j (A)
287306
```
288307

289-
Note that $colsum_j(A) = 1 + b - d$ for $j=1,2$ and by {eq}`PF_bounds` we can thus conclude that the dominant eigenvalue
308+
Note that $\text{colsum}_j(A) = 1 + b - d$ for $j=1,2$ and by {eq}`PF_bounds` we can thus conclude that the dominant eigenvalue
290309
is $r(A) = 1 + b - d$.
291310

292311
Denote $g = b - d$ as the overall growth rate of the total labor force, so that $r(A) = 1 + g$.
@@ -396,9 +415,11 @@ The graph illustrates that for two distinct initial conditions $x_0$ the sequenc
396415

397416
This suggests that all such sequences share strong similarities in the long run, determined by the dominant eigenvector $\bar{x}$.
398417

418+
#### Negative growth rate
419+
399420
In the example illustrated above we considered parameters such that overall growth rate of the labor force $g>0$.
400421

401-
Suppose now we are faced with a situation where the $g<0$, i.e, negative growth in the labor force.
422+
Suppose now we are faced with a situation where the $g<0$, i.e., negative growth in the labor force.
402423

403424
This means that $b-d<0$, i.e., workers exit the market faster than they enter.
404425

@@ -411,40 +432,46 @@ lm = LakeModel(α=0.01, λ=0.1, d=0.025, b=0.02)
411432
plot_time_paths(lm, x0=x0)
412433
```
413434

414-
Thus, while the sequence of iterates still move towards the dominant eigenvector $\bar{x}$, in this case
435+
Thus, while the sequence of iterates still moves towards the dominant eigenvector $\bar{x}$, in this case
415436
they converge to the origin.
416437

417438
This is a result of the fact that $r(A)<1$, which ensures that the iterative sequence $(A^t x_0)_{t \geq 0}$ will converge
418439
to some point, in this case to $(0,0)$.
419440

420-
This leads us into the next result.
441+
This leads us to the next result.
442+
443+
### Properties
421444

422445
Since the column sums of $A$ are $r(A)=1$, the left eigenvector is $\mathbb{1}^\top=[1, 1]$.
423446

424447
Perron-Frobenius theory implies that
425448

426449
$$
427-
r(A)^{-t} A^{t} \approx \bar{x} \mathbb{1}^\top = \begin{pmatrix} \bar{u} & \bar{u} \\ \bar{e} & \bar{e} \end{pmatrix}.
450+
r(A)^{-t} A^{t} \approx \bar{x} \mathbb{1}^\top = \begin{bmatrix} \bar{u} & \bar{u} \\ \bar{e} & \bar{e} \end{bmatrix}.
428451
$$
429452

430453
As a result, for any $x_0 = (u_0, e_0)^\top$, we have
431454

432455
$$
433-
x_t= A^t x_0 \approx r(A)^t \begin{pmatrix} \bar{u} & \bar{u} \\ \bar{e} & \bar{e} \end{pmatrix} \begin{pmatrix}u_0 \\ e_0 \end{pmatrix}
434-
= (1+g)^t(u_0 + e_0) \begin{pmatrix}\bar{u} \\ \bar{e} \end{pmatrix} = (1 + g)^t n_0 \bar{x} = n_t \bar{x}.
456+
\begin{aligned}
457+
x_t = A^t x_0 &\approx r(A)^t \begin{bmatrix} \bar{u} & \bar{u} \\ \bar{e} & \bar{e} \end{bmatrix} \begin{bmatrix}u_0 \\ e_0 \end{bmatrix} \\
458+
&= (1+g)^t(u_0 + e_0) \begin{bmatrix}\bar{u} \\ \bar{e} \end{bmatrix} \\
459+
&= (1 + g)^t n_0 \bar{x} \\
460+
&= n_t \bar{x}.
461+
\end{aligned}
435462
$$
436463

437464
as $t$ is large enough.
438465

439466
We see that the growth of $u_t$ and $e_t$ also dominated by $r(A) = 1+g$ in the long run: $x_t$ grows along $D$ as $r(A) > 1$ and converges to $(0, 0)$ as $r(A) < 1$.
440467

441-
Moreover, the long-run uneumploment and employment are steady fractions of $n_t$.
468+
Moreover, the long-run unemployment and employment are steady fractions of $n_t$.
442469

443470
The latter implies that $\bar{u}$ and $\bar{e}$ are long-run unemployment rate and employment rate, respectively.
444471

445472
In detail, we have the unemployment rates and employment rates: $x_t / n_t = A^t n_0 / n_t \to \bar{x}$ as $t \to \infty$.
446473

447-
To illustate the dynamics of the rates, let $\hat{A} := A / (1+g)$ be the transition matrix of $r_t := x_t/ n_t$.
474+
To illustrate the dynamics of the rates, let $\hat{A} := A / (1+g)$ be the transition matrix of $r_t := x_t/ n_t$.
448475

449476
The dynamics of the rates follow
450477

@@ -458,7 +485,10 @@ Observe that the column sums of $\hat{A}$ are all one so that $r(\hat{A})=1$.
458485
One can check that $\bar{x}$ is also the right eigenvector of $\hat{A}$ corresponding to $r(\hat{A})$ that $\bar{x} = \hat{A} \bar{x}$.
459486

460487
Moreover, $\hat{A}^t r_0 \to \bar{x}$ as $t \to \infty$ for any $r_0 = x_0 / n_0$, since the above discussion implies
461-
$$r_t = \hat{A}^t r_0 = (1+g)^{-t} A^t r_0 = r(A)^{-t} A^t r_0 \to \begin{pmatrix} \bar{u} & \bar{u} \\ \bar{e} & \bar{e} \end{pmatrix} r_0 = \begin{pmatrix} \bar{u} \\ \bar{e} \end{pmatrix}. $$
488+
489+
$$
490+
r_t = \hat{A}^t r_0 = (1+g)^{-t} A^t r_0 = r(A)^{-t} A^t r_0 \to \begin{bmatrix} \bar{u} & \bar{u} \\ \bar{e} & \bar{e} \end{bmatrix} r_0 = \begin{bmatrix} \bar{u} \\ \bar{e} \end{bmatrix}.
491+
$$
462492

463493
This is illustrated below.
464494

@@ -501,11 +531,11 @@ To provide more intuition for convergence, we further explain the convergence be
501531

502532
Suppose that $\hat{A} = P D P^{-1}$ is diagonalizable, where $P = [v_1, v_2]$ consists of eigenvectors $v_1$ and $v_2$ of $\hat{A}$
503533
corresponding to eigenvalues $\gamma_1$ and $\gamma_2$ respectively,
504-
and $D = diag(\gamma_1, \gamma_2)$.
534+
and $D = \text{diag}(\gamma_1, \gamma_2)$.
505535

506536
Let $\gamma_1 = r(\hat{A})=1$ and $|\gamma_2| < \gamma_1$, so that the spectral radius is a dominant eigenvalue.
507537

508-
The dynamics of the rates follows $r_{t+1} = \hat{A} r_t$, where $r_0$ is a probability vector: $\sum_j r_{0,j}=1$.
538+
The dynamics of the rates follow $r_{t+1} = \hat{A} r_t$, where $r_0$ is a probability vector: $\sum_j r_{0,j}=1$.
509539

510540
Consider $z_t = P^{-1} r_t $.
511541

@@ -514,8 +544,8 @@ Then, we have $z_{t+1} = P^{-1} r_{t+1} = P^{-1} \hat{A} r_t = P^{-1} \hat{A} P
514544
Hence, we obtain $z_t = D^t z_0$, and for some $z_0 = (c_1, c_2)^\top$ we have
515545

516546
$$
517-
r_t = P z_t = \begin{pmatrix} v_1 & v_2 \end{pmatrix} \begin{pmatrix} \gamma_1^t & 0 \\ 0 & \gamma_2^t \end{pmatrix}
518-
\begin{pmatrix} c_1 \\ c_2 \end{pmatrix} = c_1 \gamma_1^t v_1 + c_2 \gamma_2^t v_2.
547+
r_t = P z_t = \begin{bmatrix} v_1 & v_2 \end{bmatrix} \begin{bmatrix} \gamma_1^t & 0 \\ 0 & \gamma_2^t \end{bmatrix}
548+
\begin{bmatrix} c_1 \\ c_2 \end{bmatrix} = c_1 \gamma_1^t v_1 + c_2 \gamma_2^t v_2.
519549
$$
520550

521551
Since $|\gamma_2| < |\gamma_1|=1$, the second term in the right hand side converges to zero.
@@ -528,17 +558,24 @@ In this case, $c_1 v_1$ must be a normalized eigenvector, so $c_1 v_1 = \bar{x}$
528558

529559
## Exercise
530560

561+
```{exercise-start} Evolution of unemployment and employment rate
531562
:label: lake_model_ex1
563+
```
532564

533-
How do the long-run unemployment rate and employment rate elvove if there is an increase in the separation rate $\alpha$
565+
How do the long-run unemployment rate and employment rate evolve if there is an increase in the separation rate $\alpha$
534566
or a decrease in job finding rate $\lambda$?
535567

536568
Is the result compatible with your intuition?
537569

538570
Plot the graph to illustrate how the line $D := \{ x \in \mathbb{R}^2 : x = \alpha \bar{x} \; \text{for some} \; \alpha >0 \}$
539571
shifts in the unemployment-employment space.
540572

573+
```{exercise-end}
574+
```
575+
576+
```{solution-start} lake_model_ex1
541577
:class: dropdown
578+
```
542579

543580
Eq. {eq}`steady_x` implies that the long-run unemployment rate will increase, and the employment rate will decrease
544581
if $\alpha$ increases or $\lambda$ decreases.
@@ -564,3 +601,6 @@ ax.plot([0, s * lm.ū], [0, s * lm.ē], "r--", lw=1, label='set $D$, α=0.04')
564601
ax.legend(loc='best')
565602
plt.show()
566603
```
604+
605+
```{solution-end}
606+
```

0 commit comments

Comments
 (0)