Solving Leontief’s Input-Output model in Python

Peter Puszko
3 min readOct 12, 2020

--

Leontief’s input-output model supports economists in understanding interdependencies between different sectors or countries. The model consists of a table showing flows between inputs and outputs, which inadvertently also exhibits technological requirements for sectors, giving the input-output table the designation of “technology matrix”.

The technology matrix presents a framework that is used in a multitude of contexts which are reliant on trade, particularly trade in value added, R&D content of intermediates, wage structures, material offshoring, carbon dioxide (CO2) content of trade, and factor content of trade.

Through coefficients of intermediary products required by unit of a sector, the technology matrix allows to compute utilization of outputs as inputs. As sectors are co-dependent where they need more of themselves and other sectors, production can be broken-down into three parts:

1. Proportion of a sector used to produce more of that sector

2. Proportion of other sectors used to produce more of that sector

3. Proportion of a sector used for final demand and trade

To illustrate this co-dependence, we can use an economy consisting of two sectors: electricity and petroleum. The electricity sector requires electricity and petroleum to generate more electricity. It also has leftover electricity which can be used in the petroleum sector, which in turn also requires more petroleum to generate leftover petroleum to be used in the electricity sector.

This relationship can be expressed by the following equations:

We illustrate the Leontief input-output model with the following example:

Where 350 units of electricity are used in the production of electricity and 400 units of electricity are used in the production of petroleum. Final demand for electricity is 4250 units, which means that electricity total output is 5,000 units. On the other hand, 275 units of petroleum are used in the production of electricity and 100 units of petroleum units are used in the production of petroleum. Final demand for electricity is 9,625, which means that petroleum total output is 10,000 units.

To calculate the technical coefficient matrix — matrix (A), the inverse of the total output vector is multiplied by an identity matrix, which is then multiplied by the intermediates table. The following code can be used in Python to generate matrix (A):

tot_output = np.array([5000, 10000])
flow_tbl = np.array([[350, 400], [275, 100]])
mx_A = flow_tbl.dot(np.linalg.inv(tot_output * np.identity(2)))

where tot_output is the total output from the previous table and flow_tbl aggregates the inputs into each sector.

Matrix (A) takes the following shape:

We can then apply the Leontief inverse to obtain the technology matrix — matrix (B), which consists of taking the inverse of an identity matrix minus the technical coefficient matrix ([I — A]^-1). The following code can be used in Python to generate matrix (B):

mx_B = np.linalg.inv(np.identity(2) — mx_A)

Matrix (B) takes the following shape:

In short, the Leontief inverse quantifies the relationship between sectors. It summarizes the domino effect of changes in a network where alterations in one sector impact the supply of another — a powerful tool to understand the relationship between inputs and outputs.

--

--

Peter Puszko
Peter Puszko

Written by Peter Puszko

Understanding the World through numbers

No responses yet