Calculates commonly used indicators for empirical international trade analysis from user-supplied data. Measures include trade openness, bilateral export and import intensity, the Herfindahl-Hirschman concentration index, normalized and entropy-based diversification, structural diversification relative to a benchmark, export similarity, trade complementarity, revealed comparative advantage, and intra-industry trade. Functions are vectorized where appropriate, validate economically meaningful inputs, and require no external data service. The definition of trade openness follows the World Bank indicator metadata < https://data.worldbank.org/indicator/NE.TRD.GNFS.ZS>. Methodological background for several trade indicators is provided by the World Bank's World Integrated Trade Solution < https://wits.worldbank.org/wits/wits/witshelp/Content/Utilities/e1.trade_indicators.htm> and the World Trade Organization (2012, ISBN:9789287038128).
tradeIndices provides dependency-light R functions for frequently used
international trade indicators. It accepts user-supplied numeric data, so the
core calculations do not depend on an API key or internet connection.
install.packages("tradeIndices")
For the development source directory:
install.packages("path/to/tradeIndices", repos = NULL, type = "source")
| Function | Indicator |
|---|---|
trade_openness() |
Exports plus imports as a share of GDP |
trade_intensity() |
Bilateral export intensity |
import_intensity() |
Bilateral import intensity |
trade_concentration() |
HHI or normalized HHI |
trade_diversification() |
HHI-, entropy-, or effective-number diversity |
trade_diversification_index() |
Structural distance from a benchmark |
export_similarity() |
Similarity between two export structures |
trade_complementarity() |
Export-import structural complementarity |
rca_balassa() |
Balassa revealed comparative advantage |
grubel_lloyd() |
Product-level or aggregate intra-industry trade |
library(tradeIndices)
trade_openness(
exports = c(120, 135, 150),
imports = c(100, 115, 125),
gdp = c(500, 540, 590)
)
trade_intensity(
bilateral_exports = 25,
reporter_exports = 200,
world_exports_to_partner = 400,
world_exports = 5000
)
product_exports <- c(rice = 45, wheat = 25, tea = 20, spices = 10)
trade_concentration(product_exports)
trade_diversification(product_exports)
country_exports <- c(rice = 45, wheat = 25, tea = 20, spices = 10)
world_exports <- c(rice = 20, wheat = 35, tea = 15, spices = 30)
trade_diversification_index(country_exports, world_exports)
export_similarity(country_exports, world_exports)
Trade intensity greater than one indicates a bilateral export share exceeding the partner's reference share in world imports. High HHI indicates concentration; high HHI-based or entropy-based diversity indicates a broader trade structure. The structural diversification index is a distance measure: higher values mean greater dissimilarity from the benchmark, not necessarily a more even export basket.