Changelog
Source:NEWS.md
icio 1.0.0
First release of icio, a rename and consolidation of the CRAN package decompr (Quast and Kummritz 2015), whose original maintainer is no longer active. The package is now maintained by Sebastian Krantz, a co-author of later decompr versions, at https://github.com/SebKrantz/icio, and starts fresh at 1.0.0 with no backwards compatibility with decompr.
The last CRAN release of decompr was 6.9.0, and everything below is relative to it. Two further decompr versions were developed but never published – 7.0.0 (completing the Borin-Mancini variant surface) and 8.0.0 (reducing the intermediate object) – so their changes are included here.
The Borin-Mancini decomposition
-
bm()now covers the full set of Stataicioperspectives and approaches. In 6.9.0 it offered the exporter/source and world/sink variants only; it now additionally supports-
perspective = "exporter"withapproach = "sink"(9 terms; the bilateral level addsVAXIM, the domestic VA absorbed by the direct importer), -
perspective = "world"withapproach = "source"(9 terms), -
perspective = "self"(sector or bilateral level), the export flow’s own perimeter, giving the broader Johnson (2018) / Los et al. (2016) domestic value added (9 terms), and -
flow = "imports", an importer-perspective decomposition of gross imports into value added and double counting (GIMP = VA + DC), at the country level or by value-added origin.
decompose()in the Julia package GlobalValueChains.jl (formerlyICIO.jl), reproduces the Stataiciocommand’s output, and agrees with the Julia implementation to machine precision on real ICIO tables. -
Loading ICIO tables
load_tables_vectors()is replaced byload_icio(), which returns an object of classicio(previouslydecompr). Its arguments are named after the elements of aniottable –inter,final,countries,industries,output,va– rather thanx, y, k, i, o, v. Aniot-class list such asdata(leather)is detected automatically when passed as the first argument, so there is no separateiotargument:load_icio(leather)andload_icio(inter, final, countries, industries)both work.New
load_icio_csv()reads the CSV format of the Stataiciocommand – a headerlessGN x (GN + G)matrix[inter | final]plus a one-column country-list file – viadata.table::fread(). Industry codes may be given as a vector, as a path to a one-column CSV, or omitted (defaulting tosector1 ... sectorN). This mirrorsread_icio_csv()in GlobalValueChains.jl.-
The intermediate object has been reduced. In 6.9.0 it carried five dense
GN x GNmatrices, but only two held independent information:Am,Bd,BmandLwere masked or block-diagonal copies of the input coefficients and of the Leontief inverse, andBdandLwere stored dense despite being block-diagonal, hence1 - 1/Gstructural zeros (98% atG = 50). The object now holds the full input coefficient matrixA(previously onlyAm, with the domestic blocks zeroed, was kept) and the domestic Leontief inverse as the listLbof theGlocalN x Nblocks it consists of. The fieldsAm,Bd,Bm,L,Eint,Efdandrownamare gone; the object isA,B,Lb,E,ESR,Vc,G,N,GN,k,i,X,Y,Yd,Ym. Code that used the removed fields can rebuild them withAm <- A; Bd <- matrix(0, GN, GN); Bm <- B; L <- matrix(0, GN, GN) for (g in seq_len(G)) { bg <- (g - 1L) * N + seq_len(N) Am[bg, bg] <- 0; Bd[bg, bg] <- B[bg, bg]; Bm[bg, bg] <- 0; L[bg, bg] <- Lb[[g]] }and
EfdequalsYm,EintequalsESR - Ym,rownamequalsnames(Vc). The decomposition functions derive whatever masked forms they need.
leontief(),kww()andbm()work entirely off the diagonal blocks ofBand offLb, without ever materializing a denseBd,BmorL.wwz(), which uses the masked matrices in dense products throughout, rebuildsAm,BdandBmon entry.The loader is faster and allocates far less: the block-diagonal
Lcomes fromGsmall solves instead of one densesolve(I - Ad)(two orders of magnitude cheaper for an identical result), exports by destination are assembled frominterandYdirectly instead of from a maskedcbind(inter, final)copy, and formingI - Ain place avoids aGN x GNidentity matrix. On a 50-country, 40-industry table the object went from 160 MB to 66 MB and construction from 5.2 to 4.1 seconds, with all decompositions reproducing their previous results to within 3e-12 relative.Fixed: an output vector supplied through an
iotobject was silently ignored, because the loader looked for the elementoutputwhiledata(leather)and theiotdocumentation call itout(R’s partial matching does not bridge the two). Both names are now accepted, as is an optionalvaelement.
Running decompositions
decomp()now takes anicioobject (or a list of them) instead of raw tables, so the expensive construction step is always explicit and reusable. Its defaultmethodis"bm", the recommended decomposition.Given a list of
icioobjects – typically one ICIO table per year –decomp()runs the decomposition on each and stacks the results withdata.table::rbindlist(), prepending an identifier column named byidcol(default"Label",NULLto omit). This mirrors theDictmethod ofdecompose()in GlobalValueChains.jl.All decompositions now return a
data.tablerather than adata.frame. Note thatd[, "GEXP"]returns a one-column table rather than a vector, andd[c("GEXP", "DVA")]is a join rather than a column subset – used$GEXP,d[, .(GEXP, DVA)], oras.data.frame(d)for base-R semantics.data.tableis a new dependency.kww()is substantially faster: re-associatingBm %*% Am %*% L %*% ZasBm %*% (Am %*% (L %*% Z)), withZhaving onlyGcolumns, removes twoGN x GN x GNmatrix products. On a 2000 x 2000 table it went from 10.3 to 0.6 seconds. A deadVc * Ballocation was also removed.bm(),leontief(),kww(),wwz()andwwz2kww()are otherwise unchanged, including their arguments and term names.Fixed: 34 roxygen lines in
wwz()’s documentation used a typographic apostrophe (#’) instead of#'and were therefore silently dropped, leaving the help page without its@returnsection describing the 16 terms.
Removed
The RStudio addin (
decomp_gadget()) and itsaddins.dcf, the deprecatedload_tables()interface, the unusedtiva()stub, thekww_example/kww_experimentalscratch files, and the package startup message.The
gvcpackage is no longer suggested; it was not used by any test, example or vignette. (It is in any case unaffected by the object reduction, using onlyG,N,GN,k,iandX.)
Documentation
- New pkgdown website at https://sebkrantz.github.io/icio/ and a rewritten package vignette,
vignette("icio").