Skip to content

Commit f5d60a4

Browse files
committed
2 parents 3be2b66 + 7b8e529 commit f5d60a4

4 files changed

Lines changed: 18 additions & 10 deletions

File tree

lectures/dovis_accounting_mf.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ They thought about them at the beginning of the Reagan administration, when the
4747
4848
Sargent and Wallace's title, "Some Unpleasant Monetarist Arithmetic," expressed the idea that in the face of a persistent net-of-interest government deficit, efforts to reduce inflation through tight monetary policy work only temporarily, if at all.
4949
50+
5051
That is because they lead to higher government debt and thus greater gross-of-interest government deficits that must be financed in the future.
5152
```
5253

@@ -102,6 +103,7 @@ In addition to what's in Anaconda, this lecture will need the following librarie
102103
tags: [hide-output]
103104
---
104105
!pip install jax
106+
105107
```
106108

107109

lectures/hansen_jagannathan_1991.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def crra_points_from_consumption(consumption, β=0.95, γ_grid=None):
150150
growth = np.asarray(consumption[1:] / consumption[:-1], dtype=float)
151151
means = []
152152
sigmas = []
153+
153154
154155
for γ in γ_grid:
155156
m = β * growth ** γ

lectures/hansen_richard_1987.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ from scipy.optimize import minimize
9797
from scipy import stats
9898
import pandas as pd
9999
100+
100101
```
101102

102103
## Data generation

lectures/match_transport.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ Given a **cost function** $c \colon X \times Y \rightarrow \mathbb{R}$, the (dis
6868
$$
6969
\begin{aligned}
7070
\min_{\mu \geq 0}& \sum_{(x,y) \in X \times Y} \mu_{xy}c_{xy} \\
71-
\text{s.t. }& \sum_{x \in X} \mu_{xy} = n_x \\
72-
& \sum_{y \in Y} \mu_{xy} = m_y
71+
\text{s.t. }& \sum_{y \in Y} \mu_{xy} = n_x \\
72+
& \sum_{x \in X} \mu_{xy} = m_y
7373
\end{aligned}
7474
$$
7575

@@ -110,8 +110,8 @@ Hence, our problem is
110110
$$
111111
\begin{aligned}
112112
\min_{\mu \in \mathbb{Z}_+^{X \times Y}}& \sum_{(x,y) \in X \times Y} \mu_{xy}|x-y|^{1/\zeta} \\
113-
\text{s.t. }& \sum_{x \in X} \mu_{xy} = n_x \\
114-
& \sum_{y \in Y} \mu_{xy} = m_y
113+
\text{s.t. }& \sum_{y \in Y} \mu_{xy} = n_x \\
114+
& \sum_{x \in X} \mu_{xy} = m_y
115115
\end{aligned}
116116
$$
117117

@@ -1677,8 +1677,8 @@ Let's recall the formulation
16771677
$$
16781678
\begin{aligned}
16791679
V_P = \min_{\mu \geq 0}& \sum_{(x,y) \in X \times Y} \mu_{xy}c_{xy} \\
1680-
\text{s.t. }& \sum_{x \in X} \mu_{xy} = n_x \\
1681-
& \sum_{y \in Y} \mu_{xy} = m_y
1680+
\text{s.t. }& \sum_{y \in Y} \mu_{xy} = n_x \\
1681+
& \sum_{x \in X} \mu_{xy} = m_y
16821682
\end{aligned}
16831683
$$
16841684
@@ -1706,8 +1706,8 @@ Then we can formulate the following problem and its dual
17061706
$$
17071707
\begin{aligned}
17081708
W_P = \max_{\mu \geq 0}& \sum_{(x,y) \in X \times Y} \mu_{xy}y_{xy} \\
1709-
\text{s.t. }& \sum_{x \in X} \mu_{xy} = n_x \\
1710-
& \sum_{y \in Y} \mu_{xy} = m_y
1709+
\text{s.t. }& \sum_{y \in Y} \mu_{xy} = n_x \\
1710+
& \sum_{x \in X} \mu_{xy} = m_y
17111711
\end{aligned}
17121712
$$
17131713
@@ -1731,6 +1731,10 @@ The dual solution $(u,v)$ of $W_D$ can be interpreted as equilibrium utilities o
17311731
17321732
{cite}`boerma2023composite` propose an efficient method to compute the dual variables from the optimal matching (primal solution) in the case of composite sorting.
17331733
1734+
Their approach relies on *Complementary Slackness*: given a primal solution $\mu$, $(\phi , \psi) $ is a dual solution if and only if for all $x \in X$ and $y \in Y$
1735+
* $\phi_x + \psi_y \leq c_{xy}$ (dual feasibility),
1736+
* $\phi_x + \psi_y = c_{xy}$ if $\mu_{xy}>0$ (complementary slackness).
1737+
17341738
Let's generate an instance and compute the optimal matching.
17351739
17361740
```{code-cell} ipython3
@@ -1952,7 +1956,7 @@ exam_assign_OD.plot_hierarchies(subpairs)
19521956
19531957
We proceed to describe and implement the algorithm to compute the dual solution.
19541958
1955-
As already mentioned, the algorithm starts from the matched pairs $(x_0,y_0)$ with no subpairs and assigns the (temporary) values $\psi_{x_0} = c_{x_0 y_0}$ and $\psi_{y_0} = 0,$ i.e. the $x$ type sustains the whole cost of matching.
1959+
As already mentioned, the algorithm starts from the matched pairs $(x_0,y_0)$ with no subpairs and assigns the (temporary) values $\phi_{x_0} = c_{x_0 y_0}$ and $\psi_{y_0} = 0,$ i.e. the $x$ type sustains the whole cost of matching.
19561960
19571961
19581962
@@ -1972,7 +1976,7 @@ $$
19721976
\leq \min (c_{x_0 y_j} + c_{x_i y_0} - c_{x_0 y_0} , c_{x_i y_j}) - c_{x_j y_j} , \quad \text{for all } 1 \leq i < j \leq p.
19731977
$$
19741978
1975-
Then for all $i \in [p]$ compute the adjustment $ \Delta_i = \sum_{k = i+1}^p \beta_k + \phi_{x_p} - \phi_{x_1}$ and modify the dual variables
1979+
Then for all $i \in [p]$ compute the adjustment $ \Delta_i = \sum_{k = i+1}^p \beta_k + \phi_{x_p} - \phi_{x_i}$ and modify the dual variables
19761980
19771981
$$
19781982
\begin{aligned}

0 commit comments

Comments
 (0)