API reference

ICIO.ICIOModule
ICIO

Fast value-added and Global Value Chain (GVC) decompositions of Inter-Country Input-Output (ICIO) tables, following the Borin & Mancini (2019) framework implemented by the Stata icio command (Belotti, Borin & Mancini 2021).

Workflow:

using ICIO
m = read_icio_csv("EM_2015.csv", "EM_countrylist.csv")   # or load_icio(VA, FD, T; regions, sectors)
decompose(m; level = :country, perspective = :world, approach = :sink)  # 9-term corrected KWW
decompose(m; level = :sector)                                            # 13-term exporter/source
decompose(m; level = :bilateral)                                         # 13-term, per importer
source

Loading a table

ICIO.load_icioFunction
load_icio(VA, FD, T; regions, sectors, X = nothing)

Build an ICIOModel from the three core matrices, mirroring decompr's load_tables_vectors:

  • TGN×GN intermediate transactions (T[i,j] = inputs from country-sector i used by j).
  • FDGN×G final demand (FD[i,r] = final goods i absorbed in country r).
  • VA — length-GN value added, or nothing to use the icio residual X .- vec(sum(T;dims=1)).

regions (length G) and sectors (length N) are country/industry names. X (output) is computed as rowSums(T) + rowSums(FD) when not supplied.

Note: to reproduce icio exactly, value added is the column residual of the table. Passing a VA that differs from X .- colSums(T) makes column sums of V*B deviate from 1 (so DC + FC may differ slightly from gross exports) — faithful to the supplied data.

source
ICIO.read_icio_csvFunction
read_icio_csv(table_csv, countrylist_csv; sectors = nothing, X = nothing, VA = nothing)

Load an ICIOModel from the icio CSV format used by the Stata icio command and produced by STATA_ICIO_CSVs_V2.R:

  • table_csv — headerless GN × (GN + G) matrix [T | FD]: the first GN columns are the intermediate transactions T, the last G columns the final demand FD (one per country).
  • countrylist_csv — headerless one-column file of G country codes (e.g. ISO3).

The number of sectors is inferred as N = GN / G. sectors names the industries and may be a vector of N codes, a path to a headerless one-column CSV of sector codes (like countrylist_csv), or nothing (defaults to "sector1"…"sectorN"). Supplying the real sector codes means every output DataFrame carries them in from_sector from the start. By default value added is the icio column residual (X .- colSums(T)), reproducing icio exactly; pass VA/X to override.

source
ICIO.ICIOModelType
ICIOModel

Holds an Inter-Country Input-Output table and all matrices/vectors precomputed once and reused across decompositions. Construct with load_icio or read_icio_csv.

Fields of interest: G (countries), N (sectors), GN = G*N, regions, sectors, X (output), V (value-added coefficients), A, B (global Leontief inverse), L (block-diagonal local Leontief), E (total exports), ESR (bilateral exports by destination, GN×G), FD (final demand by absorbing country, GN×G).

source

Decompositions

ICIO.decomposeFunction
decompose(m::ICIOModel; level = :country, perspective = :exporter, approach = :source)

Decompose gross exports into value-added / GVC components, returning a tidy DataFrame.

  • level = :country — one row per exporting country.
    • perspective = :world, approach = :sink → 9 terms (corrected KWW / Borin-Mancini).
    • perspective = :exporter, approach = :source (default) → 13 terms.
  • level = :sector — one row per exporting country-sector (:exporter/:source, 13 terms).
  • level = :bilateral— one row per exporter-sector × importer (:exporter/:source, 13 terms), excluding own-country destinations.

Columns are absolute values (same currency units as the table). See read_icio_csv and load_icio for constructing m, and decompose over a Dict of years for batch processing.

source
decompose(years::AbstractDict; level = :country, perspective = :exporter, approach = :source)

Batch version: years maps a year (or any label) to an ICIOModel. Runs the decomposition for each, prepends a :year column, and vertically concatenates the results (rows ordered by sorted year). Mirrors the foreach y in $years loop of ICIO_decomp.do.

source

Index