proximity()
computes two matrices that account for the
similarity between pairs of countries and pairs of products.
proximity(balassa_index, compute = "both")
(Type: dgCMatrix) the output from
balassa_index()
) or an equivalent arrangement.
(Type: character) the proximity to compute. By default this is
"both"
(both proximity matrices) but it can also be "country"
or "product"
.
A list of two matrices.
The current implementation follows (Hausmann et al. 2014) to obtain the likelihood that two products "p1" and "p2" are exported by the same country and, conversely, that two countries "c1" and "c2" export the same product.
For more information see:
Hausmann R, Hidalgo C, Bustos S, Coscia M, Simoes A, Yildirim M (2014). The atlas of economic complexity: Mapping paths to prosperity. MIT Press. doi:10.7551/mitpress/9647.001.0001 .
and the references therein.
pro <- proximity(economiccomplexity_output$balassa_index)
# partial view of proximity matrices
pro$proximity_country[1:5, 1:5]
#> 5 x 5 sparse Matrix of class "dsCMatrix"
#> afg ago aia alb and
#> afg 1.00000000 0.015873016 0.181818182 0.19689119 0.192513369
#> ago 0.01587302 1.000000000 0.006993007 0.01554404 0.005347594
#> aia 0.18181818 0.006993007 1.000000000 0.16580311 0.251336898
#> alb 0.19689119 0.015544041 0.165803109 1.00000000 0.310880829
#> and 0.19251337 0.005347594 0.251336898 0.31088083 1.000000000
pro$proximity_product[1:5, 1:5]
#> 5 x 5 sparse Matrix of class "dsCMatrix"
#> 0011 0012 0013 0014 0015
#> 0011 1.0000000 0.3658537 0.1707317 0.2439024 0.2682927
#> 0012 0.3658537 1.0000000 0.2500000 0.2250000 0.2500000
#> 0013 0.1707317 0.2500000 1.0000000 0.2500000 0.1200000
#> 0014 0.2439024 0.2250000 0.2500000 1.0000000 0.2250000
#> 0015 0.2682927 0.2500000 0.1200000 0.2250000 1.0000000