| Title: | Friendly Input-Output Analysis |
|---|---|
| Description: | Simplifies the process of economic input-output analysis by combining user-friendly interfaces with high-performance computation. It provides tools for analyzing both single-region and multi-regional economic systems through a hybrid architecture that pairs R's accessibility with Rust's computational efficiency. |
| Authors: | Alberson da Silva Miranda [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-9252-4175>), Celso Bissoli Sessa [dtc] (ORCID: <https://orcid.org/0000-0001-7616-0244>) |
| Maintainer: | Alberson da Silva Miranda <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.1.0.9000 |
| Built: | 2026-06-08 00:15:24 UTC |
| Source: | https://github.com/albersonmiranda/fio |
Downloads World Input-Output Database tables.
download_wiod(year = "2016", out_dir = tempdir())download_wiod(year = "2016", out_dir = tempdir())
year |
( |
out_dir |
( |
Multi-region input-output tables from the World Input-Output Database (WIOD) from University of Groningen, Netherlands.
Invisibly returns the path to the downloaded file.
## Not run: fio::download_wiod("2016") ## End(Not run)## Not run: fio::download_wiod("2016") ## End(Not run)
fio_addin() opens an RStudio gadget and
addin that allows you to say
where the data source is (either clipboard or Excel file) and import the
data into the global environment.
Appears as "Import input-output data" in the RStudio Addins menu.
fio_addin()fio_addin()
This function is based on the reprex package.
Import data from a input-output matrix (IOM) from Excel format.
import_element(file, sheet, range, col_names = FALSE, row_names = FALSE)import_element(file, sheet, range, col_names = FALSE, row_names = FALSE)
file |
Path to the Excel file. |
sheet |
Name of the sheet in the Excel file. |
range |
Range of cells in the Excel file. |
col_names |
Range of cells with column names. |
row_names |
Range of cells with row names. |
A (matrix).
if (isNamespaceLoaded("fiodata")) { # Excel file with IOM data path_to_xlsx <- system.file("extdata", "/2020.xlsx", package = "fiodata") # Import IOM data intermediate_transactions <- import_element( file = path_to_xlsx, sheet = "iom", range = "D6:BB56", col_names = "D4:BB4", row_names = "B6:B56" ) # Show the first 6 rows and 6 columns intermediate_transactions[1:6, 1:6] }if (isNamespaceLoaded("fiodata")) { # Excel file with IOM data path_to_xlsx <- system.file("extdata", "/2020.xlsx", package = "fiodata") # Import IOM data intermediate_transactions <- import_element( file = path_to_xlsx, sheet = "iom", range = "D6:BB56", col_names = "D4:BB4", row_names = "B6:B56" ) # Show the first 6 rows and 6 columns intermediate_transactions[1:6, 1:6] }
R6 class for input-output matrix.
A new instance of the iom class.
id(character)
Identifier of the new instance.
intermediate_transactions(matrix)
Intermediate transactions matrix.
total_production(matrix)
Total production vector.
household_consumption(matrix)
Household consumption vector.
government_consumption(matrix)
Government consumption vector.
exports(matrix)
Exports vector.
final_demand_others(matrix)
Other vectors of final demand that doesn't have dedicated slots.
final_demand_matrix(matrix)
Aggregates final demand vectors into a matrix.
imports(matrix)
Imports vector.
taxes(matrix)
Taxes vector.
wages(matrix)
Wages vector.
operating_income(matrix)
Operating income vector.
value_added_others(matrix)
Other vectors of value-added that doesn't have dedicated slots.
value_added_matrix(matrix)
Aggregates value-added vectors into a matrix.
occupation(matrix)
Occupation vector.
technical_coefficients_matrix(matrix)
Technical coefficients matrix.
leontief_inverse_matrix(matrix)
Leontief inverse matrix.
multiplier_output(data.frame)
Output multiplier dataframe.
multiplier_employment(data.frame)
Employment multiplier dataframe.
multiplier_taxes(data.frame)
Taxes multiplier dataframe.
multiplier_wages(data.frame)
Wages multiplier dataframe.
field_influence(matrix)
Influence field matrix.
key_sectors(data.frame)
Key sectors dataframe.
allocation_coefficients_matrix(matrix)
Allocation coefficients matrix.
ghosh_inverse_matrix(matrix)
Ghosh inverse matrix.
hypothetical_extraction(matrix)
Absolute and relative backward and forward differences in total output after a hypothetical extraction
iom$new()Creates a new instance of this R6 class.
iom$new( id, intermediate_transactions, total_production, household_consumption = NULL, government_consumption = NULL, exports = NULL, final_demand_others = NULL, imports = NULL, taxes = NULL, wages = NULL, operating_income = NULL, value_added_others = NULL, occupation = NULL )
id(character)
Identifier for the input-output matrix.
intermediate_transactions(matrix)
Intermediate transactions matrix.
total_production(matrix)
Total production vector.
household_consumption(matrix)
Household consumption vector.
government_consumption(matrix)
Government consumption vector.
exports(matrix)
Exports vector.
final_demand_others(matrix)
Other vectors of final demand that doesn't have dedicated slots.
Setting column names is advised for better readability.
imports(matrix)
Imports vector.
taxes(matrix)
Taxes vector.
wages(matrix)
Wages vector.
operating_income(matrix)
Operating income vector.
value_added_others(matrix)
Other vectors of value-added that doesn't have dedicated slots.
Setting row names is advised for better readability.
occupation(matrix)
Occupation matrix.
iom$add()Adds a matrix to the iom object.
iom$add(matrix_name, matrix)
matrix_name(character)
One of household_consumption, government_consumption, exports, final_demand_others,
imports, taxes, wages, operating income, value_added_others or occupation matrix to be added.
matrix(matrix)
Matrix object to be added.
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- iom$new("mock", intermediate_transactions, total_production)
# Create a dummy matrix
exports_data <- matrix(as.numeric(1:3), 3, 1)
# Add the matrix
my_iom$add("exports", exports_data)
iom$remove()Removes a matrix from the iom object.
iom$remove(matrix_name)
matrix_name(character)
One of household_consumption, government_consumption, exports, final_demand_others,
imports, taxes, wages, operating_income, value_added_others or occupation matrix to be removed.
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
exports_data <- matrix(as.numeric(1:3), 3, 1)
# instantiate iom object
my_iom <- iom$new("mock", intermediate_transactions, total_production, exports = exports_data)
# Remove the matrix
my_iom$remove("exports")
iom$close_model()Closes the model by moving specified sectors from final demand to intermediate transactions.
iom$close_model(sectors)
sectors(character) Vector specifying which sectors to close.
Must be one or both of "household" or "government".
A closed model treats households and/or government as endogenous sectors by moving them from final demand to the intermediate transactions matrix, along with their corresponding value-added components (wages for households, taxes for government).
When closing with households:
Household consumption becomes a new column in intermediate transactions
Wages become a new row in intermediate transactions
Both are removed from final demand and value-added matrices respectively
When closing with government:
Government consumption becomes a new column in intermediate transactions
Taxes become a new row in intermediate transactions
Both are removed from final demand and value-added matrices respectively
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
household_consumption <- matrix(c(10, 20, 30), 3, 1)
wages <- matrix(c(15, 25, 35), 1, 3)
# instantiate iom object
my_iom <- iom$new(
"mock",
intermediate_transactions,
total_production,
household_consumption = household_consumption,
wages = wages
)
# close the model with household sector
my_iom$close_model("household")
iom$update_final_demand_matrix()Aggregates final demand vectors into the final_demand_matrix field.
iom$update_final_demand_matrix()
Some methods, as $compute_hypothetical_extraction(), require the final demand and value-added vectors
to be aggregated into a matrix. This method does this aggregation, binding the vectors into
$final_demand_matrix.
This functions doesn't returns a value.
# data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports_data <- matrix(c(10, 20, 30), 3, 1) households <- matrix(as.numeric(4:6), 3, 1) # instantiate iom object my_iom <- iom$new( "mock", intermediate_transactions, total_production, exports = exports_data, household_consumption = households ) # aggregate all final demand vectors my_iom$update_final_demand_matrix() # check final demand matrix my_iom$final_demand_matrix
iom$update_value_added_matrix()Aggregates value-added vectors into the value_added_matrix field.
iom$update_value_added_matrix()
Some methods, as $compute_hypothetical_extraction(), require the final demand and value-added vectors
to be aggregated into a matrix. This method does this aggregation, binding the vectors into
$value_added_matrix.
This functions doesn't returns a value.
# data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) imports_data <- matrix(c(5, 10, 15), 1, 3) taxes_data <- matrix(c(2, 5, 10), 1, 3) # instantiate iom object my_iom <- iom$new( "mock", intermediate_transactions, total_production, imports = imports_data, taxes = taxes_data ) # aggregate all value-added vectors my_iom$update_value_added_matrix() # check value-added matrix my_iom$value_added_matrix
iom$compute_tech_coeff()Computes the technical coefficients matrix and populate the technical_coefficients_matrix field with the
resulting (matrix).
iom$compute_tech_coeff()
It computes the technical coefficients matrix, a matrix known as A matrix which is the column-wise
ratio of intermediate transactions to total production (Leontief 1983).
Leontief W (1983). A Economia do Insumo-Produto, Os Economistas. Abril Cultural, São Paulo.
Self (invisibly).
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- iom$new("test", intermediate_transactions, total_production)
# Calculate the technical coefficients
my_iom$compute_tech_coeff()
# show the technical coefficients
my_iom$technical_coefficients_matrix
iom$compute_leontief_inverse()Computes the Leontief inverse matrix and populate the leontief_inverse_matrix field with the resulting
(matrix).
iom$compute_leontief_inverse()
It computes the Leontief inverse matrix (Leontief 1983), which is the inverse of the Leontief matrix, defined as:
where I is the identity matrix and A is the technical coefficients matrix. The Leontief inverse matrix is calculated by solving the following equation:
Since the Leontief matrix is a square matrix and the subtraction of the technical coefficients matrix from the identity matrix guarantees that the Leontief matrix is invertible, underlined Rust function uses LU decomposition to solve the equation.
Leontief W (1983). A Economia do Insumo-Produto, Os Economistas. Abril Cultural, São Paulo.
Self (invisibly).
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production)
# calculate the technical coefficients
my_iom$compute_tech_coeff()
# calculate the Leontief inverse
my_iom$compute_leontief_inverse()
# show the Leontief inverse
my_iom$leontief_inverse_matrix
iom$compute_multiplier_output()Computes the output multiplier and populate the multiplier_output field with the resulting (data.frame).
iom$compute_multiplier_output()
An output multiplier for sector j is defined as the total value of production in all sectors of the economy that is necessary in order to satisfy a monetary unit (e.g., a dollar) worth of final demand for sector j's output (Miller and Blair 2009).
This method computes the simple output multiplier, defined as the column sums of the Leontief inverse matrix, the direct and indirect output multipliers, which are the column sums of the technical coefficients matrix and the difference between total and direct output multipliers, respectively (Vale and Perobelli 2020).
Miller RE, Blair PD (2009).
Input-Output Analysis: Foundations and Extensions, 2 edition.
Cambridge University Press.
ISBN 978-0-521-73902-3 978-0-521-51713-3 978-0-511-62698-2.
doi:10.1017/CBO9780511626982.
https://www.cambridge.org/core/product/identifier/9780511626982/type/book.
Vale VdA, Perobelli FS (2020).
Análise de Insumo-Produto: teoria e aplicações no R.
Edição Independente, Curitiba, PR.
ISBN 9786500103649.
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production)
# calculate the technical coefficients
my_iom$compute_tech_coeff()
# calculate the Leontief inverse
my_iom$compute_leontief_inverse()
# calculate the output multiplier
my_iom$compute_multiplier_output()
# show the output multiplier
my_iom$multiplier_output
iom$compute_multiplier_employment()Computes the employment multiplier and populate the multiplier_employment field with the resulting
(data.frame).
iom$compute_multiplier_employment()
The employment multiplier for sector j relates the jobs created in each sector in response to a initial exogenous shock (Miller and Blair 2009).
Current implementation follows (Vale and Perobelli 2020).
Miller RE, Blair PD (2009).
Input-Output Analysis: Foundations and Extensions, 2 edition.
Cambridge University Press.
ISBN 978-0-521-73902-3 978-0-521-51713-3 978-0-511-62698-2.
doi:10.1017/CBO9780511626982.
https://www.cambridge.org/core/product/identifier/9780511626982/type/book.
Vale VdA, Perobelli FS (2020).
Análise de Insumo-Produto: teoria e aplicações no R.
Edição Independente, Curitiba, PR.
ISBN 9786500103649.
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
jobs_data <- matrix(c(10, 12, 15), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production, occupation = jobs_data)
# calculate the technical coefficients
my_iom$compute_tech_coeff()
# calculate the Leontief inverse
my_iom$compute_leontief_inverse()
# calculate the employment multiplier
my_iom$compute_multiplier_employment()
# show the employment multiplier
my_iom$multiplier_employment
iom$compute_multiplier_wages()Computes the wages multiplier dataframe and populate the multiplier_wages field with the resulting
(data.frame).
iom$compute_multiplier_wages()
The wages multiplier for sector j relates increases in wages for each sector in response to a initial exogenous shock (Miller and Blair 2009).
Current implementation follows (Vale and Perobelli 2020).
Miller RE, Blair PD (2009).
Input-Output Analysis: Foundations and Extensions, 2 edition.
Cambridge University Press.
ISBN 978-0-521-73902-3 978-0-521-51713-3 978-0-511-62698-2.
doi:10.1017/CBO9780511626982.
https://www.cambridge.org/core/product/identifier/9780511626982/type/book.
Vale VdA, Perobelli FS (2020).
Análise de Insumo-Produto: teoria e aplicações no R.
Edição Independente, Curitiba, PR.
ISBN 9786500103649.
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
wages_data <- matrix(c(10, 12, 15), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production, wages = wages_data)
# calculate the technical coefficients
my_iom$compute_tech_coeff()
# calculate the Leontief inverse
my_iom$compute_leontief_inverse()
# calculate the wages multiplier
my_iom$compute_multiplier_wages()
# show the wages multiplier
my_iom$multiplier_wages
iom$compute_multiplier_taxes()Computes the taxes multiplier and populate the multiplier_taxes field with
the resulting (data.frame).
iom$compute_multiplier_taxes()
The taxes multiplier for sector j relates the increases on tax revenue from each sector in response to a initial exogenous shock (Miller and Blair 2009).
Current implementation follows (Vale and Perobelli 2020).
Miller RE, Blair PD (2009).
Input-Output Analysis: Foundations and Extensions, 2 edition.
Cambridge University Press.
ISBN 978-0-521-73902-3 978-0-521-51713-3 978-0-511-62698-2.
doi:10.1017/CBO9780511626982.
https://www.cambridge.org/core/product/identifier/9780511626982/type/book.
Vale VdA, Perobelli FS (2020).
Análise de Insumo-Produto: teoria e aplicações no R.
Edição Independente, Curitiba, PR.
ISBN 9786500103649.
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
tax_data <- matrix(c(10, 12, 15), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production, taxes = tax_data)
# calculate the technical coefficients
my_iom$compute_tech_coeff()
# calculate the Leontief inverse
my_iom$compute_leontief_inverse()
# calculate the tax multiplier
my_iom$compute_multiplier_taxes()
# show the taxes multiplier
my_iom$multiplier_taxes
iom$compute_field_influence()Computes the field of influence for all sectors and populate the
field_influence field with the resulting (matrix).
iom$compute_field_influence(epsilon)
epsilon(numeric)
Epsilon value. A technical change in the input-output matrix, caused by a variation of size epsilon into each
element of technical coefficients matrix.
The field of influence shows how changes in direct coefficients are distributed throughout the entire economic system, allowing for the determination of which relationships between sectors are most important within the production process.
It determines which sectors have the greatest influence over others, specifically, which coefficients, when altered, would have the greatest impact on the system as a whole (Vale and Perobelli 2020).
Vale VdA, Perobelli FS (2020). Análise de Insumo-Produto: teoria e aplicações no R. Edição Independente, Curitiba, PR. ISBN 9786500103649.
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production)
# calculate the technical coefficients
my_iom$compute_tech_coeff()
# calculate the Leontief inverse
my_iom$compute_leontief_inverse()
# calculate field of influence
my_iom$compute_field_influence(epsilon = 0.01)
# show the field of influence
my_iom$field_influence
iom$compute_key_sectors()Computes the key sectors dataframe, based on it's power and sensitivity of dispersion,
and populate the key_sectors field with the resulting (data.frame).
iom$compute_key_sectors(matrix = "leontief")
matrix(matrix)
Which matrix should be used when computing forward linkage, Leontief or Ghoshian? Defaults to Leontief.
Increased production from a sector j means that the sector j will need to purchase more goods from other sectors. At the same time, it means that more goods from sector j will be available for other sectors to purchase. Sectors that are above average in the demand sense (stronger backward linkage) have power of dispersion indices greater than 1. Sectors that are above average in the supply sense (stronger forward linkage) have sensitivity of dispersion indices greater than 1 (Miller and Blair 2009).
As both power and sensitivity of dispersion are related to average values on the economy, coefficients of variation are also calculated for both indices. The lesser the coefficient of variation, greater the number of sectors on the demand or supply structure of that sector (Vale and Perobelli 2020).
Miller RE, Blair PD (2009).
Input-Output Analysis: Foundations and Extensions, 2 edition.
Cambridge University Press.
ISBN 978-0-521-73902-3 978-0-521-51713-3 978-0-511-62698-2.
doi:10.1017/CBO9780511626982.
https://www.cambridge.org/core/product/identifier/9780511626982/type/book.
Vale VdA, Perobelli FS (2020).
Análise de Insumo-Produto: teoria e aplicações no R.
Edição Independente, Curitiba, PR.
ISBN 9786500103649.
Self (invisibly).
# data
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production)
# calculate the technical coefficients
my_iom$compute_tech_coeff()
# calculate the Leontief inverse
my_iom$compute_leontief_inverse()
# calculate key sectors
my_iom$compute_key_sectors()
# show the key sectors
my_iom$key_sectors
iom$compute_allocation_coeff()Computes the allocation coefficients matrix and populate the allocation_coefficients_matrix field with the
resulting (matrix).
iom$compute_allocation_coeff()
It computes the allocation coefficients matrix, a matrix known as B matrix which is the row-wise
ratio of intermediate transactions to total production (Miller and Blair 2009).
Miller RE, Blair PD (2009). Input-Output Analysis: Foundations and Extensions, 2 edition. Cambridge University Press. ISBN 978-0-521-73902-3 978-0-521-51713-3 978-0-511-62698-2. doi:10.1017/CBO9780511626982. https://www.cambridge.org/core/product/identifier/9780511626982/type/book.
Self (invisibly).
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production)
# Calculate the allocation coefficients
my_iom$compute_allocation_coeff()
# show the allocation coefficients
my_iom$allocation_coefficients_matrix
iom$compute_ghosh_inverse()Computes the Ghosh inverse matrix and populate the ghosh_inverse_matrix field with the resulting (matrix).
iom$compute_ghosh_inverse()
It computes the Ghosh inverse matrix (Miller and Blair 2009), defined as:
where I is the identity matrix and B is the allocation coefficients matrix.
Miller RE, Blair PD (2009). Input-Output Analysis: Foundations and Extensions, 2 edition. Cambridge University Press. ISBN 978-0-521-73902-3 978-0-521-51713-3 978-0-511-62698-2. doi:10.1017/CBO9780511626982. https://www.cambridge.org/core/product/identifier/9780511626982/type/book.
Self (invisibly).
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production)
# Calculate the allocation coefficients
my_iom$compute_allocation_coeff()
# Calculate the Ghosh inverse
my_iom$compute_ghosh_inverse()
# show the Ghosh inverse
my_iom$ghosh_inverse_matrix
iom$compute_hypothetical_extraction()Computes total impact after extracting a each sector and populate the hypothetical_extraction field with the
resulting (data.frame).
iom$compute_hypothetical_extraction(matrix = "ghosh")
matrix(matrix)
Which matrix should be used when computing forward linkage, Leontief or Ghoshian? Defaults to Ghoshian.
Computes impact on demand and supply structures after extracting each sector (Miller and Blair 2009).
The total impact is calculated by the sum of the direct and indirect impacts.
Miller RE, Blair PD (2009). Input-Output Analysis: Foundations and Extensions, 2 edition. Cambridge University Press. ISBN 978-0-521-73902-3 978-0-521-51713-3 978-0-511-62698-2. doi:10.1017/CBO9780511626982. https://www.cambridge.org/core/product/identifier/9780511626982/type/book.
Self (invisibly).
# data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports_data <- matrix(c(5, 10, 15), 3, 1) holsehold_consumption_data <- matrix(c(20, 25, 30), 3, 1) operating_income_data <- matrix(c(2, 5, 10), 1, 3) taxes_data <- matrix(c(1, 2, 3), 1, 3) # instantiate iom object my_iom <- fio::iom$new( "test", intermediate_transactions, total_production, exports = exports_data, household_consumption = holsehold_consumption_data, operating_income = operating_income_data, taxes = taxes_data ) # update value-added matrix my_iom$update_value_added_matrix() # update final demand matrix my_iom$update_final_demand_matrix() # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate allocation coefficients my_iom$compute_allocation_coeff() # calculate Ghosh inverse my_iom$compute_ghosh_inverse() # calculate hypothetical extraction my_iom$compute_hypothetical_extraction() # show results my_iom$hypothetical_extraction
iom$set_max_threads()Sets max number of threads used by fio and populate the threads field with the resulting (integer).
iom$set_max_threads(max_threads)
max_threads(integer)
Number of threads enabled for parallel computing. Defaults to 0, meaning all
threads available.
Calling this function sets a global limit of threads to Rayon crate, affecting all computations that runs in parallel by default.
Default behavior of Rayon is to use all available threads (including logical). Setting to 1 will result in single threaded (sequential) computations.
Initialization of the global thread pool happens exactly once. Once started, the configuration cannot be changed
in the current session. If $set_max_threads() is called again in the same session, it'll result in an error.
Methods that deals with linear algebra computations, like $compute_leontief_inverse() and
$compute_ghosh_inverse(), will try to use all available threads by default, so they also initializes global
thread pool. In order to choose a maximum number of threads other than default, $set_max_threads() must be
called before any computation, preferably right after iom$new().
This function does not return a value.
intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
total_production <- matrix(c(100, 200, 300), 1, 3)
# instantiate iom object
my_iom <- fio::iom$new("test", intermediate_transactions, total_production)
# to run single threaded (sequential)
my_iom$set_max_threads(1L)
iom$clone()The objects of this class are cloneable with this method.
iom$clone(deep = FALSE)
deepWhether to make a deep clone.
# data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports <- matrix(c(10, 20, 30), 3, 1) households <- matrix(as.numeric(4:6), 3, 1) imports <- matrix(c(5, 10, 15), 1, 3) jobs <- matrix(c(10, 12, 15), 1, 3) taxes <- matrix(c(2, 5, 10), 1, 3) wages <- matrix(c(11, 12, 13), 1, 3) # a new iom instance can be created by passing just intermediate transactions and total production my_iom <- iom$new( "example_1", intermediate_transactions, total_production ) # or by passing optional arguments my_iom <- iom$new( "example_2", intermediate_transactions, total_production, household_consumption = households, exports = exports, imports = imports, taxes = taxes, wages = wages, occupation = jobs ) ## ------------------------------------------------ ## Method `iom$add()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- iom$new("mock", intermediate_transactions, total_production) # Create a dummy matrix exports_data <- matrix(as.numeric(1:3), 3, 1) # Add the matrix my_iom$add("exports", exports_data) ## ------------------------------------------------ ## Method `iom$remove()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports_data <- matrix(as.numeric(1:3), 3, 1) # instantiate iom object my_iom <- iom$new("mock", intermediate_transactions, total_production, exports = exports_data) # Remove the matrix my_iom$remove("exports") ## ------------------------------------------------ ## Method `iom$close_model()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) household_consumption <- matrix(c(10, 20, 30), 3, 1) wages <- matrix(c(15, 25, 35), 1, 3) # instantiate iom object my_iom <- iom$new( "mock", intermediate_transactions, total_production, household_consumption = household_consumption, wages = wages ) # close the model with household sector my_iom$close_model("household") ## ------------------------------------------------ ## Method `iom$update_final_demand_matrix()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports_data <- matrix(c(10, 20, 30), 3, 1) households <- matrix(as.numeric(4:6), 3, 1) # instantiate iom object my_iom <- iom$new( "mock", intermediate_transactions, total_production, exports = exports_data, household_consumption = households ) # aggregate all final demand vectors my_iom$update_final_demand_matrix() # check final demand matrix my_iom$final_demand_matrix ## ------------------------------------------------ ## Method `iom$update_value_added_matrix()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) imports_data <- matrix(c(5, 10, 15), 1, 3) taxes_data <- matrix(c(2, 5, 10), 1, 3) # instantiate iom object my_iom <- iom$new( "mock", intermediate_transactions, total_production, imports = imports_data, taxes = taxes_data ) # aggregate all value-added vectors my_iom$update_value_added_matrix() # check value-added matrix my_iom$value_added_matrix ## ------------------------------------------------ ## Method `iom$compute_tech_coeff()` ## ------------------------------------------------ intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- iom$new("test", intermediate_transactions, total_production) # Calculate the technical coefficients my_iom$compute_tech_coeff() # show the technical coefficients my_iom$technical_coefficients_matrix ## ------------------------------------------------ ## Method `iom$compute_leontief_inverse()` ## ------------------------------------------------ intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # show the Leontief inverse my_iom$leontief_inverse_matrix ## ------------------------------------------------ ## Method `iom$compute_multiplier_output()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate the output multiplier my_iom$compute_multiplier_output() # show the output multiplier my_iom$multiplier_output ## ------------------------------------------------ ## Method `iom$compute_multiplier_employment()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) jobs_data <- matrix(c(10, 12, 15), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production, occupation = jobs_data) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate the employment multiplier my_iom$compute_multiplier_employment() # show the employment multiplier my_iom$multiplier_employment ## ------------------------------------------------ ## Method `iom$compute_multiplier_wages()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) wages_data <- matrix(c(10, 12, 15), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production, wages = wages_data) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate the wages multiplier my_iom$compute_multiplier_wages() # show the wages multiplier my_iom$multiplier_wages ## ------------------------------------------------ ## Method `iom$compute_multiplier_taxes()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) tax_data <- matrix(c(10, 12, 15), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production, taxes = tax_data) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate the tax multiplier my_iom$compute_multiplier_taxes() # show the taxes multiplier my_iom$multiplier_taxes ## ------------------------------------------------ ## Method `iom$compute_field_influence()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate field of influence my_iom$compute_field_influence(epsilon = 0.01) # show the field of influence my_iom$field_influence ## ------------------------------------------------ ## Method `iom$compute_key_sectors()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate key sectors my_iom$compute_key_sectors() # show the key sectors my_iom$key_sectors ## ------------------------------------------------ ## Method `iom$compute_allocation_coeff()` ## ------------------------------------------------ intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # Calculate the allocation coefficients my_iom$compute_allocation_coeff() # show the allocation coefficients my_iom$allocation_coefficients_matrix ## ------------------------------------------------ ## Method `iom$compute_ghosh_inverse()` ## ------------------------------------------------ intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # Calculate the allocation coefficients my_iom$compute_allocation_coeff() # Calculate the Ghosh inverse my_iom$compute_ghosh_inverse() # show the Ghosh inverse my_iom$ghosh_inverse_matrix ## ------------------------------------------------ ## Method `iom$compute_hypothetical_extraction()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports_data <- matrix(c(5, 10, 15), 3, 1) holsehold_consumption_data <- matrix(c(20, 25, 30), 3, 1) operating_income_data <- matrix(c(2, 5, 10), 1, 3) taxes_data <- matrix(c(1, 2, 3), 1, 3) # instantiate iom object my_iom <- fio::iom$new( "test", intermediate_transactions, total_production, exports = exports_data, household_consumption = holsehold_consumption_data, operating_income = operating_income_data, taxes = taxes_data ) # update value-added matrix my_iom$update_value_added_matrix() # update final demand matrix my_iom$update_final_demand_matrix() # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate allocation coefficients my_iom$compute_allocation_coeff() # calculate Ghosh inverse my_iom$compute_ghosh_inverse() # calculate hypothetical extraction my_iom$compute_hypothetical_extraction() # show results my_iom$hypothetical_extraction ## ------------------------------------------------ ## Method `iom$set_max_threads()` ## ------------------------------------------------ ## Not run: intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # to run single threaded (sequential) my_iom$set_max_threads(1L) ## End(Not run)# data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports <- matrix(c(10, 20, 30), 3, 1) households <- matrix(as.numeric(4:6), 3, 1) imports <- matrix(c(5, 10, 15), 1, 3) jobs <- matrix(c(10, 12, 15), 1, 3) taxes <- matrix(c(2, 5, 10), 1, 3) wages <- matrix(c(11, 12, 13), 1, 3) # a new iom instance can be created by passing just intermediate transactions and total production my_iom <- iom$new( "example_1", intermediate_transactions, total_production ) # or by passing optional arguments my_iom <- iom$new( "example_2", intermediate_transactions, total_production, household_consumption = households, exports = exports, imports = imports, taxes = taxes, wages = wages, occupation = jobs ) ## ------------------------------------------------ ## Method `iom$add()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- iom$new("mock", intermediate_transactions, total_production) # Create a dummy matrix exports_data <- matrix(as.numeric(1:3), 3, 1) # Add the matrix my_iom$add("exports", exports_data) ## ------------------------------------------------ ## Method `iom$remove()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports_data <- matrix(as.numeric(1:3), 3, 1) # instantiate iom object my_iom <- iom$new("mock", intermediate_transactions, total_production, exports = exports_data) # Remove the matrix my_iom$remove("exports") ## ------------------------------------------------ ## Method `iom$close_model()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) household_consumption <- matrix(c(10, 20, 30), 3, 1) wages <- matrix(c(15, 25, 35), 1, 3) # instantiate iom object my_iom <- iom$new( "mock", intermediate_transactions, total_production, household_consumption = household_consumption, wages = wages ) # close the model with household sector my_iom$close_model("household") ## ------------------------------------------------ ## Method `iom$update_final_demand_matrix()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports_data <- matrix(c(10, 20, 30), 3, 1) households <- matrix(as.numeric(4:6), 3, 1) # instantiate iom object my_iom <- iom$new( "mock", intermediate_transactions, total_production, exports = exports_data, household_consumption = households ) # aggregate all final demand vectors my_iom$update_final_demand_matrix() # check final demand matrix my_iom$final_demand_matrix ## ------------------------------------------------ ## Method `iom$update_value_added_matrix()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) imports_data <- matrix(c(5, 10, 15), 1, 3) taxes_data <- matrix(c(2, 5, 10), 1, 3) # instantiate iom object my_iom <- iom$new( "mock", intermediate_transactions, total_production, imports = imports_data, taxes = taxes_data ) # aggregate all value-added vectors my_iom$update_value_added_matrix() # check value-added matrix my_iom$value_added_matrix ## ------------------------------------------------ ## Method `iom$compute_tech_coeff()` ## ------------------------------------------------ intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- iom$new("test", intermediate_transactions, total_production) # Calculate the technical coefficients my_iom$compute_tech_coeff() # show the technical coefficients my_iom$technical_coefficients_matrix ## ------------------------------------------------ ## Method `iom$compute_leontief_inverse()` ## ------------------------------------------------ intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # show the Leontief inverse my_iom$leontief_inverse_matrix ## ------------------------------------------------ ## Method `iom$compute_multiplier_output()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate the output multiplier my_iom$compute_multiplier_output() # show the output multiplier my_iom$multiplier_output ## ------------------------------------------------ ## Method `iom$compute_multiplier_employment()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) jobs_data <- matrix(c(10, 12, 15), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production, occupation = jobs_data) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate the employment multiplier my_iom$compute_multiplier_employment() # show the employment multiplier my_iom$multiplier_employment ## ------------------------------------------------ ## Method `iom$compute_multiplier_wages()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) wages_data <- matrix(c(10, 12, 15), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production, wages = wages_data) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate the wages multiplier my_iom$compute_multiplier_wages() # show the wages multiplier my_iom$multiplier_wages ## ------------------------------------------------ ## Method `iom$compute_multiplier_taxes()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) tax_data <- matrix(c(10, 12, 15), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production, taxes = tax_data) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate the tax multiplier my_iom$compute_multiplier_taxes() # show the taxes multiplier my_iom$multiplier_taxes ## ------------------------------------------------ ## Method `iom$compute_field_influence()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate field of influence my_iom$compute_field_influence(epsilon = 0.01) # show the field of influence my_iom$field_influence ## ------------------------------------------------ ## Method `iom$compute_key_sectors()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate key sectors my_iom$compute_key_sectors() # show the key sectors my_iom$key_sectors ## ------------------------------------------------ ## Method `iom$compute_allocation_coeff()` ## ------------------------------------------------ intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # Calculate the allocation coefficients my_iom$compute_allocation_coeff() # show the allocation coefficients my_iom$allocation_coefficients_matrix ## ------------------------------------------------ ## Method `iom$compute_ghosh_inverse()` ## ------------------------------------------------ intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # Calculate the allocation coefficients my_iom$compute_allocation_coeff() # Calculate the Ghosh inverse my_iom$compute_ghosh_inverse() # show the Ghosh inverse my_iom$ghosh_inverse_matrix ## ------------------------------------------------ ## Method `iom$compute_hypothetical_extraction()` ## ------------------------------------------------ # data intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) exports_data <- matrix(c(5, 10, 15), 3, 1) holsehold_consumption_data <- matrix(c(20, 25, 30), 3, 1) operating_income_data <- matrix(c(2, 5, 10), 1, 3) taxes_data <- matrix(c(1, 2, 3), 1, 3) # instantiate iom object my_iom <- fio::iom$new( "test", intermediate_transactions, total_production, exports = exports_data, household_consumption = holsehold_consumption_data, operating_income = operating_income_data, taxes = taxes_data ) # update value-added matrix my_iom$update_value_added_matrix() # update final demand matrix my_iom$update_final_demand_matrix() # calculate the technical coefficients my_iom$compute_tech_coeff() # calculate the Leontief inverse my_iom$compute_leontief_inverse() # calculate allocation coefficients my_iom$compute_allocation_coeff() # calculate Ghosh inverse my_iom$compute_ghosh_inverse() # calculate hypothetical extraction my_iom$compute_hypothetical_extraction() # show results my_iom$hypothetical_extraction ## ------------------------------------------------ ## Method `iom$set_max_threads()` ## ------------------------------------------------ ## Not run: intermediate_transactions <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3) total_production <- matrix(c(100, 200, 300), 1, 3) # instantiate iom object my_iom <- fio::iom$new("test", intermediate_transactions, total_production) # to run single threaded (sequential) my_iom$set_max_threads(1L) ## End(Not run)
R6 class for multi-regional input-output matrix (MRIO). This class inherits from the
iom class and extends its functionality to handle multi-regional input-output tables
such as the World Input-Output Database (WIOD) and EXIOBASE tables.
A new instance of the miom class.
iom -> miom
countries(character)
Vector of region names.
sectors(character)
Vector of sector names.
n_countries(integer)
Number of regions in the matrix.
n_sectors(integer)
Number of sectors per country.
bilateral_trade(list)
Bilateral trade flows between regions by sector.
domestic_intermediate_transactions(list)
List of domestic intermediate transaction matrices by region.
international_intermediate_transactions(list)
List of international intermediate transaction matrices between regions.
multiregional_multipliers(data.frame)
Multi-regional output multipliers including intra-regional, inter-regional, and spillover effects.
iom$add()iom$close_model()iom$compute_allocation_coeff()iom$compute_field_influence()iom$compute_ghosh_inverse()iom$compute_hypothetical_extraction()iom$compute_leontief_inverse()iom$compute_multiplier_employment()iom$compute_multiplier_taxes()iom$compute_multiplier_wages()iom$compute_tech_coeff()iom$remove()iom$set_max_threads()iom$update_final_demand_matrix()iom$update_value_added_matrix()miom$new()Creates a new instance of this R6 class.
miom$new( id, intermediate_transactions, total_production, countries, sectors, household_consumption = NULL, government_consumption = NULL, exports = NULL, final_demand_others = NULL, imports = NULL, taxes = NULL, wages = NULL, operating_income = NULL, value_added_others = NULL, occupation = NULL )
id(character)
Identifier for the multi-regional input-output matrix.
intermediate_transactions(matrix)
Multi-regional intermediate transactions matrix. Rows and columns should follow
the structure: Country1_Sector1, Country1_Sector2, ..., Country2_Sector1 etc.
total_production(matrix)
Total production vector by country and sector.
countries(character)
Vector of region names in the matrix.
sectors(character)
Vector of sector names in the matrix.
household_consumption(matrix)
Household consumption vector by region and sector.
government_consumption(matrix)
Government consumption vector by region and sector.
exports(matrix)
Exports vector by region and sector.
final_demand_others(matrix)
Other vectors of final demand that doesn't have dedicated slots.
imports(matrix)
Imports vector by region and sector.
taxes(matrix)
Taxes vector by region and sector.
wages(matrix)
Wages vector by region and sector.
operating_income(matrix)
Operating income vector by region and sector.
value_added_others(matrix)
Other vectors of value-added that doesn't have dedicated slots.
occupation(matrix)
Occupation matrix by region and sector.
miom$extract_country()Extract domestic input-output matrix for a specific country.
miom$extract_country(country)
country(character)
Country name/code to extract.
An iom object for the specified country.
miom$get_bilateral_trade()Get bilateral trade flows between two countries by sector.
miom$get_bilateral_trade(origin_country, destination_country)
origin_country(character)
Origin country name/code.
destination_country(character)
Destination country name/code.
A matrix of trade flows by sector from origin to destination.
miom$get_country_summary()Get summary statistics by country for multipliers.
miom$get_country_summary()
A data.frame with summary statistics by country.
miom$compute_multiplier_output()Override the parent compute_multiplier_output to add country/sector information.
miom$compute_multiplier_output()
Self (invisibly).
miom$compute_key_sectors()Override the parent compute_key_sectors to add country/sector information.
miom$compute_key_sectors(matrix = "leontief")
matrix(character)
Which matrix to use for forward linkage computation: "leontief" or "ghosh".
Self (invisibly).
miom$compute_multiregional_multipliers()Compute multi-regional output multipliers following Miller & Blair (2009), section 6.3.2–6.3.3. For a unit final-demand shock in a country-sector (a column of the Leontief inverse), returns intra-regional and inter-regional (spillover) output multipliers.
miom$compute_multiregional_multipliers()
Self (invisibly).
miom$get_spillover_matrix()Compute spillover effects matrix showing how shocks in each region-sector affect output in all other regions. Returns off-diagonal regional blocks of the Leontief inverse (Miller & Blair, 2009, interregional spillover effects; section 6.3.2).
miom$get_spillover_matrix()
A matrix of spillover effects.
miom$get_net_spillover_matrix()Compute net spillover effects for each country pair. For countries r and
s, net[r, s] = spillover_{s->r} - spillover_{r->s} (block sums from
get_spillover_matrix()). A positive value means country r receives more
cross-regional output response from shocks in s than s receives from
shocks in r.
miom$get_net_spillover_matrix()
A matrix showing net spillover effects between countries.
miom$get_regional_interdependence()Compute regional self-reliance and cross-regional spillover measures by country. Sector-level intra-regional multipliers follow Miller & Blair (2009, section 6.3.2). Country spillover totals are block sums of the spillover matrix from get_spillover_matrix(): spillover out is foreign output induced by all unit shocks in the country; spillover in is domestic output induced by all unit shocks abroad.
miom$get_regional_interdependence()
A data.frame with self-reliance and spillover measures by country.
miom$clone()The objects of this class are cloneable with this method.
miom$clone(deep = FALSE)
deepWhether to make a deep clone.
# Sample multi-regional data (2 countries, 2 sectors each) countries <- c("BRA", "CHN") sectors <- c("Agriculture", "Manufacturing") # Create country-sector labels labels <- paste(rep(countries, each = 2), rep(sectors, 2), sep = "_") # Sample intermediate transactions matrix (4x4) intermediate_transactions <- matrix( c( 10, 5, 2, 1, 8, 15, 3, 2, 1, 2, 12, 4, 2, 3, 6, 18 ), nrow = 4, ncol = 4, dimnames = list(labels, labels) ) # Total production vector total_production <- matrix(c(100, 120, 80, 110), nrow = 1, ncol = 4, dimnames = list(NULL, labels) ) # Create MIOM instance my_miom <- miom$new( id = "sample_miom", intermediate_transactions = intermediate_transactions, total_production = total_production, countries = countries, sectors = sectors )# Sample multi-regional data (2 countries, 2 sectors each) countries <- c("BRA", "CHN") sectors <- c("Agriculture", "Manufacturing") # Create country-sector labels labels <- paste(rep(countries, each = 2), rep(sectors, 2), sep = "_") # Sample intermediate transactions matrix (4x4) intermediate_transactions <- matrix( c( 10, 5, 2, 1, 8, 15, 3, 2, 1, 2, 12, 4, 2, 3, 6, 18 ), nrow = 4, ncol = 4, dimnames = list(labels, labels) ) # Total production vector total_production <- matrix(c(100, 120, 80, 110), nrow = 1, ncol = 4, dimnames = list(NULL, labels) ) # Create MIOM instance my_miom <- miom$new( id = "sample_miom", intermediate_transactions = intermediate_transactions, total_production = total_production, countries = countries, sectors = sectors )