API reference

GlobalValueChains.GlobalValueChainsModule
GlobalValueChains

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

Supports the full set of icio perspectives/approaches: exporter (source & sink), world (source & sink), self (sectoral / sectoral-bilateral) export perimeters at the country, sector and bilateral levels, plus the importer-perspective decomposition of gross imports.

Workflow:

using GlobalValueChains
m = read_icio_csv("EM_2015.csv", "EM_countrylist.csv")   # or load_icio(VA, FD, T; regions, sectors)
decompose(m)                                                       # 13-term exporter/source, by country
decompose(m; perspective = :world, approach = :sink)              # 9-term corrected KWW
decompose(m; level = :sector)                                      # 13-term exporter/source by country-sector
decompose(m; level = :bilateral, approach = :sink)                # 10-term exporter/sink (adds VAXIM), per importer
decompose(m; level = :bilateral, perspective = :self)             # sectoral-bilateral (sectbil) perimeter
decompose(m; flow = :imports)                                     # importer-perspective imports, by country

See decompose for the complete table of supported flow/level/perspective/approach combinations.

source

Loading a table

GlobalValueChains.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
GlobalValueChains.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
GlobalValueChains.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

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

Decompose gross trade into value-added / GVC components (Borin & Mancini 2019), returning a tidy DataFrame. Mirrors the Stata icio command's perspectives and approaches.

flow = :exports (default) decomposes exports:

levelperspectiveapproachtermsdescription
:country:exporter:source(=sink)13gexp dc dva vax davax ref ddc fc fva fdc gvc gvcb gvcf
:country:world:source9world perimeter, FVA at first foreign crossing (eq. 52)
:country:world:sink9world perimeter, corrected KWW (eq. 54)
:sector:exporter:source13country perimeter, sectoral breakdown
:sector:exporter:sink9gexp dc dva vax ref ddc fc fva fdc
:sector:self9sectoral (sectexp) perimeter
:bilateral:exporter:source13one row per exporter-sector × importer (r≠s)
:bilateral:exporter:sink10adds vaxim (DVA absorbed by direct importer, eq. 39)
:bilateral:self9sectoral-bilateral (sectbil) perimeter

The :source approach records value added the first time it leaves country s's border (suited to production-linkage / GVC analysis); :sink records it the last time (suited to final-demand analysis). At the whole-country exporter perimeter the two coincide. The :self perimeter uses the broader Johnson (2018) / Los et al. (2016) value-added notion (DVA★ ⊇ DVAsource, DVAsink). :world is available at the country level only.

flow = :imports decomposes a country's gross imports from the importer perspective (eq. 51):

leveltermsdescription
:countrygimp va dcone row per importer
:bilateralva dcone row per (importer, value-added origin); sums over origin to imports

Columns are absolute values (same currency units as the table). See read_icio_csv / load_icio to construct m, and decompose over a Dict of years for batches.

source
decompose(years::AbstractDict; flow = :exports, 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