as.inputoutput: Creating an Input-Output Object

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/as.inputoutput.R

Description

Creates a list of class InputOutput for easier use of the other functions within ioanalysis. The Leontief inverse and Ghoshian inverse are calculated. A little work now to save a bunch of work in the future. For most functions in the package, this is a prerequisite. At a minimum, Z, X, and RS_label must be provided. See Usage for details.

Caution: Inverting large matrices will take a long time. R does a computation roughly every 8e-10 second. The number of computations per matrix inversion is n^3 where n is the dimension of the square matrix. For n = 5000 it should take 100 seconds.

Usage

1
2
as.inputoutput(Z, RS_label, f, f_label, E, E_label, X, V, V_label, M, M_label, 
               fV, fV_label, P, P_label, A, B, L, G)

Arguments

Let n = #sectors*#regions, l = # of labels, m = arbitrary length, r = #regions

Z

Required. A nxn matrix of intermediate transactions between sectors and regions. It should be in units of currency, kg, etc.

RS_label

Required. A nx2 "column" matrix of the regions in column 1 and sector in column 2. Other functions use those locations to correctly identify elements in the matices. If there is only one region, it still needs to be specified in column 1.

f

Not required. A nxm matrix of final demand. Exports SHOULD NOT be included in this matrix. Instead, put exports in the E matrix. However, net exports should stay.

f_label

Not required. A 2xn "row" matrix of the region and accounts to help identify the elements of f. The first row should be regions and the second should be regional account labels.

E

Not required. A nxr matrix of exports. Multiple columns per region is accepted.

E_label

Not required. A 2xn "row" matrix of the region and type of export to help identify the elements of E.

X

Required. A 1xn vector of total production for each sector across all regions. RS_label identifies the objects

V

Not required. A nxm matrix of value added. Imports SHOULD NOT be included in this matrix. Instead, put exports in the M matrix.

V_label

Not required. A mx1 "column" matrix where the only column is the type of value added. This helps identify the rows of value added. RS_label identifies the columns.

M

Not required. A mxn matrix of import. Multiple types of imports is accepted.

M_label

Not required. A mx1 "column" matrix to identify the rows of imports. RS_label identifies the columns.

fV

Not Required. The matrix of final demand's value added

fV_label

Not Required. Column matrix to identify the row elements of fV

P

Not Required. The matrix of intermediate transactions in physical units

P_label

Not Required. A nx2 matrix to identify the regions and sectors of P

A

Not required. A nxn matrix of technical input coefficients. If not provided, A is calculated for you.

B

Not required. A nxn matrix of technical output coefficients. If not provided, B is calculated for you.

L

Not required. The Leontief inverse. If not provided, L is calculated for you.

G

Not required. The Ghoshian inverse. If not provided, G is calculated for you.

Details

If the A matrix is not provided, it is calculated as follows:

a_{ij} = z_{ij}/x_j

If the B matrix is not provided, it is calculated as follows:

b_{ij} = z_{ij}/x_i

If the L matrix is not provided, it is calculated as follows:

L = (I-A)^{-1}

If the G matrix is not provided, it is calculated as follows:

G = (I-B)^{-1}

Value

as.inputouput retuns an object of class "InputOutput". Once created, it is sufficient to provide this object in all further functions in the ioanalysis package.

Z

Intermediate Transactions Matrix

RS_label

Column matrix of labels for the region and sectors used to identify elements in A, Z, X, L, ...

f

Final Demand

f_label

Row matrix of labels for accounts for f

E

Exports

E_label

Row matrix of labels for exports by sector and region for E

X

Total Production

V

Value added

V_label

Column matrix of labels for types of value added for V

M

Imports

M_label

Colum matrix of labels for type of imports for M

fV

The matrix of final demand's value added

fV_label

Column matrix to identify the row elements of fV

A

Technical Input Coefficients

B

Technical Input Coefficients

L

Leontief inverse

G

Ghoshian inverse

Note

Currently, there is no use for an intermediate transaction matrix in physical units (P). If you wish to carry this with the matrix then you can create the InputOutput object and add to it by using io$P <- P.

Author(s)

John J. P. wade

References

Nazara, Suahasil & Guo, Dong & Hewings, Geoffrey J.D., & Dridi, Chokri, 2003. PyIO. Input-Output Analysis with Python. REAL Discussion Paper 03-t-23. University of Illinois at Urbana-Champaign. (http://www.real.illinois.edu/d-paper/03/03-t-23.pdf)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# In toy,FullIOTable it is a full matrix of characters: a pseudo worst case scenario
data(toy.FullIOTable)
Z <- matrix(as.numeric(toy.FullIOTable[3:12, 3:12]), ncol = 10)
f <- matrix(as.numeric(toy.FullIOTable[3:12, c(13:15, 17:19)]), nrow = dim(Z)[1])
E <- matrix(as.numeric(toy.FullIOTable[3:12, c(16, 20)]), nrow = 10)
X <- matrix(as.numeric(toy.FullIOTable[3:12, 21]), ncol = 1)
V <- matrix(as.numeric(toy.FullIOTable[13:15, 3:12]), ncol = 10)
M <- as.numeric(toy.FullIOTable[16, 3:12])
fV <- matrix(as.numeric(toy.FullIOTable[15:16, c(13:15,17:19)]), nrow = 2)

# Note toy.FullIOTable is a matrix of characters: non-numeric
toy.IO <- as.inputoutput(Z = Z, RS_label = toy.FullIOTable[3:12, 1:2],
                         f = f, f_label = toy.FullIOTable[1:2, c(13:15, 17:19)],
                         E = E, E_label = toy.FullIOTable[1:2, c(16, 20)],
                         X = X,
                         V = V, V_label = toy.FullIOTable[13:15, 2],
                         M = M, M_label = toy.FullIOTable[16,2],
                         fV = fV, fV_label = toy.FullIOTable[15:16, 2])

# Notice we do not need to supply the matrix of technical coefficients (A)

Example output

Loading required package: ggplot2
Loading required package: plot3D
Loading required package: lpSolve
Warning message:
no DISPLAY variable so Tk is not available 

ioanalysis documentation built on Jan. 13, 2021, 5:16 p.m.