balassa_index()
computes the Balassa Index for a
bipartite relation between countries and products.
Usage
balassa_index(
trade_data,
discrete = TRUE,
cutoff = 1,
country = "country",
product = "product",
value = "value"
)
Arguments
- trade_data
(Type: data.frame or matrix) a dataset such as
world_gdp_avg_1998_to_2000
containing countries, products and exported values.- discrete
(Type: logical) whether converting the Balassa Index to discrete (0/1) values. Anything below the specified cutoff is converted to 0 and 1 otherwise. By default this is set to
TRUE
.- cutoff
(Type: numeric) the cutoff to use for discretization. By default this is set to
1
.- country
(Type: character) the column with the countries. By default this is set to
"country"
. Used only if the input is a data.frame.- product
(Type: character) the column with the products. By default this is set to
"product"
. Used only if the input is a data.frame.- value
(Type: character) the column with the metric for country-product pairs. By default this is set to
"value"
. Used only if the input is a data.frame.
Details
The current implementation follows (Mariani et al. 2015) to obtain a metric for specialisation. In the context of international trade, if the Balassa Index for a country-product pair is more than 1, it means that country is specialized in that product. If the input for this function is a data.frame instead of a matrix, the function shall aggregate the data and convert the input to a matrix.
References
For more information see:
Mariani M, Vidmer A, Medo M, Zhang Y (2015). “Measuring economic complexity of countries and products: which metric to use?” The European Physical Journal B, 88(11), 293. doi:10.1140/epjb/e2015-60298-7 .
and the references therein.
Examples
bi <- balassa_index(world_trade_avg_1998_to_2000)
# partial view of index
n <- seq_len(5)
bi[n, n]
#> 0011 0012 0013 0014 0015
#> afg 0 0 0 0 0
#> ago 0 0 0 0 0
#> aia 0 0 0 0 0
#> alb 0 0 0 0 0
#> and 1 0 0 0 1