Skip to content

Commit 64e740a

Browse files
authored
Merge pull request #218 from QuantEcon/fix_transpose
Fix Input Output
2 parents 383f58a + 3f0332d commit 64e740a

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

lectures/input_output.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ import numpy as np
3030
import pandas as pd
3131
import networkx as nx
3232
import matplotlib.pyplot as plt
33+
from matplotlib.patches import Polygon
3334
```
3435

3536
The following figure illustrates a network of linkages among 15 sectors
36-
obtained from the US Bureau of Economic Analysis’s 2019 Input-Output Accounts
37+
obtained from the US Bureau of Economic Analysis’s 2021 Input-Output Accounts
3738
Data.
3839

3940
```{code-cell} ipython3
@@ -88,6 +89,10 @@ tags: [hide-input]
8889
---
8990
centrality = qbn_io.eigenvector_centrality(A)
9091
92+
# Remove self-loops
93+
for i in range(A.shape[0]):
94+
A[i][i] = 0
95+
9196
fig, ax = plt.subplots(figsize=(8, 10))
9297
plt.axis("off")
9398
color_list = qbn_io.colorise_weights(centrality,beta=False)
@@ -237,11 +242,11 @@ More generally, constraints on production are
237242
$$
238243
\begin{aligned}
239244
(I - A) x & \geq d \cr
240-
a_0' x & \leq x_0
245+
a_0^\top x & \leq x_0
241246
\end{aligned}
242247
$$ (eq:inout_1)
243248
244-
where $A$ is the $n \times n$ matrix with typical element $a_{ij}$ and $a_0' = \begin{bmatrix} a_{01} & \cdots & a_{02} \end{bmatrix}$.
249+
where $A$ is the $n \times n$ matrix with typical element $a_{ij}$ and $a_0^\top = \begin{bmatrix} a_{01} & \cdots & a_{02} \end{bmatrix}$.
245250
246251
247252
@@ -322,19 +327,19 @@ x
322327
The second equation of {eq}`eq:inout_1` can be written
323328
324329
$$
325-
a_0' x = x_0
330+
a_0^\top x = x_0
326331
$$
327332
328333
or
329334
330335
$$
331-
A_0' d = x_0
336+
A_0^\top d = x_0
332337
$$ (eq:inout_frontier)
333338
334339
where
335340
336341
$$
337-
A_0' = a_0' (I - A)^{-1}
342+
A_0^\top = a_0^\top (I - A)^{-1}
338343
$$
339344
340345
For $i \in \{1, \ldots , n\}$, the $i$th component of $A_0$ is the amount of labor that is required to produce one unit of final output of good $i$.
@@ -346,12 +351,12 @@ Consider the example in {eq}`eq:inout_ex`.
346351
Suppose we are now given
347352
348353
$$
349-
a_0' = \begin{bmatrix}
354+
a_0^\top = \begin{bmatrix}
350355
4 & 100
351356
\end{bmatrix}
352357
$$
353358
354-
Then we can find $A_0'$ by
359+
Then we can find $A_0^\top$ by
355360
356361
```{code-cell} ipython3
357362
a0 = np.array([4, 100])
@@ -383,23 +388,23 @@ $$
383388
More generally,
384389
385390
$$
386-
p = A' p + a_0 w
391+
p = A^\top p + a_0 w
387392
$$
388393
389394
which states that the price of each final good equals the total cost
390-
of production, which consists of costs of intermediate inputs $A' p$
395+
of production, which consists of costs of intermediate inputs $A^\top p$
391396
plus costs of labor $a_0 w$.
392397
393398
This equation can be written as
394399
395400
$$
396-
(I - A') p = a_0 w
401+
(I - A^\top) p = a_0 w
397402
$$ (eq:inout_price)
398403
399404
which implies
400405
401406
$$
402-
p = (I - A')^{-1} a_0 w
407+
p = (I - A^\top)^{-1} a_0 w
403408
$$
404409
405410
Notice how {eq}`eq:inout_price` with {eq}`eq:inout_1` forms a
@@ -414,7 +419,7 @@ This connection surfaces again in a classic linear program and its dual.
414419
A **primal** problem is
415420
416421
$$
417-
\min_{x} w a_0' x
422+
\min_{x} w a_0^\top x
418423
$$
419424
420425
subject to
@@ -427,13 +432,13 @@ $$
427432
The associated **dual** problem is
428433
429434
$$
430-
\max_{p} p' d
435+
\max_{p} p^\top d
431436
$$
432437
433438
subject to
434439
435440
$$
436-
(I -A)' p \leq a_0 w
441+
(I -A)^\top p \leq a_0 w
437442
$$
438443
439444
The primal problem chooses a feasible production plan to minimize costs for delivering a pre-assigned vector of final goods consumption $d$.
@@ -444,7 +449,7 @@ By the [strong duality theorem](https://en.wikipedia.org/wiki/Dual_linear_progra
444449
optimal value of the primal and dual problems coincide:
445450
446451
$$
447-
w a_0' x^* = p^* d
452+
w a_0^\top x^* = p^* d
448453
$$
449454
450455
where $^*$'s denote optimal choices for the primal and dual problems.
@@ -569,12 +574,15 @@ $$
569574
\mu_j = \sum_{j=1}^n l_{ij}
570575
$$
571576
572-
This can be written as $\mu' = \mathbf{1}'L$ or
577+
This can be written as $\mu^\top = \mathbb{1}^\top L$ or
578+
573579
574580
$$
575-
\mu' = \mathbf{1}' (I-A)^{-1}
581+
\mu^\top = \mathbb{1}^\top (I-A)^{-1}
576582
$$
577583
584+
Please note that here we use $\mathbb{1}$ to represent a vector of ones.
585+
578586
High ranking sectors within this measure are important buyers of intermediate goods.
579587
580588
A demand shock in such sectors will cause a large impact on the whole production network.

0 commit comments

Comments
 (0)