@@ -4,28 +4,98 @@ jupytext:
44 extension : .md
55 format_name : myst
66 format_version : 0.13
7- jupytext_version : 1.14.4
7+ jupytext_version : 1.14.5
88kernelspec :
99 display_name : Python 3 (ipykernel)
1010 language : python
1111 name : python3
1212---
1313
1414(input_output)=
15+ # Input-Output Models
16+
17+ ``` {contents} Contents
18+ :depth: 2
19+ ```
20+
21+ ``` {code-cell} ipython3
22+ :tags: [hide-output]
23+
24+ !pip install --upgrade quantecon_book_networks quantecon pandas_datareader
25+ ```
1526
1627In this lecture, we will need the following library.
1728
18- +++
29+ ``` {code-cell} ipython3
30+ import numpy as np
31+ import pandas as pd
32+ import networkx as nx
33+ ```
1934
20- # Input-Output Models
35+ ``` {code-cell} ipython3
36+ :tags: [hide-input]
37+
38+ import quantecon as qe
39+ import quantecon_book_networks
40+ import quantecon_book_networks.input_output as qbn_io
41+ import quantecon_book_networks.plotting as qbn_plt
42+ import quantecon_book_networks.data as qbn_data
43+ import matplotlib.pyplot as plt
44+ import matplotlib.cm as cm
45+ import matplotlib.colors as plc
46+ from matplotlib import cm
47+ quantecon_book_networks.config("matplotlib")
48+ import matplotlib as mpl
49+ mpl.rcParams.update(mpl.rcParamsDefault)
50+ ```
2151
2252## Overview
2353
24- We adopt notation in chapters 8 and 9 of the classic book {cite}` DoSSo ` .
54+ The following figure illustrates a network of linkages between 71 sectors obtained from the US Bureau of Economic Analysis’s
55+ 2019 Input-Output Accounts Data.
56+
57+ ``` {code-cell} ipython3
58+ ch2_data = qbn_data.production()
59+ codes_71 = ch2_data['us_sectors_71']['codes']
60+ A_71 = ch2_data['us_sectors_71']['adjacency_matrix']
61+ X_71 = ch2_data['us_sectors_71']['total_industry_sales']
62+
63+ centrality_71 = qbn_io.eigenvector_centrality(A_71)
64+ color_list_71 = qbn_io.colorise_weights(centrality_71,beta=False)
65+
66+ fig, ax = plt.subplots(figsize=(10, 12))
67+ plt.axis("off")
68+
69+ qbn_plt.plot_graph(A_71, X_71, ax, codes_71,
70+ node_size_multiple=0.0005,
71+ edge_size_multiple=4.0,
72+ layout_type='spring',
73+ layout_seed=5432167,
74+ tol=0.01,
75+ node_color_list=color_list_71)
76+
77+ plt.show()
78+ ```
79+
80+ An arrow from $i$ to $j$ implies that sector $i$ supplies some of its output as raw material to sector $j$.
81+
82+ Economies are characterised by many such complex and interdependent multisector production networks.
83+
84+ A basic framework for their analysis is [ Leontief's] ( https://en.wikipedia.org/wiki/Wassily_Leontief ) input-output model.
85+
86+ This model's key aspect is its simplicity.
87+
88+ In this lecture, we introduce the standard input-ouput model and approach it as a [ linear programming] (link to lpp lecture) problem.
89+
90+ +++
91+
92+ ## Input Output Analysis
93+
94+ We adopt notation from chapters 9 and 10 of the classic book {cite}` DoSSo ` .
2595
26- We let
96+ Let
2797
28- * $X_0$ be the amount of a single exogenous input to production. We'll call this input labor
98+ * $X_0$ be the amount of a single exogenous input to production, say labor
2999 * $X_j, j = 1,\ldots n$ be the gross output of final good $j$
30100 * $C_j, j = 1,\ldots n$ be the net output of final good $j$ that is available for final consumption
31101 * $x_ {ij} $ be the quantity of good $i$ allocated to be an input to producing good $j$ for $i=1, \ldots n$, $j = 1, \ldots n$
@@ -43,9 +113,41 @@ X_j = \min_{i \in \{0, \ldots , n \}} \left( \frac{x_{ij}}{a_{ij}}\right)
43113$$
44114
45115
46- To illustrate ideas, we'll begin by setting $n =2$.
116+ To illustrate ideas, we begin by setting $n =2$.
117+
118+ The following is a simple illustration of this network.
119+
120+ ``` {code-cell} ipython3
121+ :tags: [hide-input]
122+
123+ G = nx.DiGraph()
124+
125+ nodes= (1,2)
126+ edges = ((1,1),(1,2),(2,1),(2,2))
127+ G.add_nodes_from(nodes)
128+ G.add_edges_from(edges)
129+
130+ pos_list = ([0,0],[2,0])
131+ pos = dict(zip(G.nodes(), pos_list))
132+ labels = (f'a_{11}',f'a_{12}',r'$a_{21}$',f'a_{22}')
133+ edge_labels = dict(zip(G.edges(), labels))
134+
135+ plt.axis("off")
136+
137+ nx.draw_networkx_nodes(G, pos=pos,node_size=800,node_color = 'white', edgecolors='black')
138+ nx.draw_networkx_labels(G, pos=pos)
139+ nx.draw_networkx_edges(G,pos = pos,node_size=300,connectionstyle='arc3,rad=0.2',arrowsize=10,min_target_margin=15)
140+ #nx.draw_networkx_edge_labels(G, pos=pos, edge_labels = edge_labels)
141+ plt.text(0.055,0.125, r'$x_{11}$')
142+ plt.text(1.825,0.125, r'$x_{22}$')
143+ plt.text(0.955,0.075, r'$x_{21}$')
144+ plt.text(0.955,-0.05, r'$x_{12}$')
145+
146+
147+ plt.show()
148+ ```
47149
48- Feasible allocations must satisfy
150+ ## Feasible allocations must satisfy
49151
50152$$
51153\begin{aligned}
182284
183285where $^*$'s denote optimal choices for the primal and dual problems.
184286
185- +++
186287
187288## Exercise
188289
231332
232333where $L$ is a vector of labor services used in each industry.
233334
234-
235-
236-
237-
238-
239-
240- ```{code-cell} ipython3
241-
242- ```
243-
244335```{code-cell} ipython3
245336
246337```
0 commit comments