projections() computes two graphs that are particularly useful to visualize product-product and country-country similarity.

projections(
  proximity_country,
  proximity_product,
  avg_links = 5,
  tolerance = 0.05,
  compute = "both"
)

Arguments

proximity_country

(Type: dgCMatrix) the output from proximity()) or an equivalent arrangement.

proximity_product

(Type: dgCMatrix) the output from proximity()) or an equivalent arrangement.

avg_links

average number of connections for the projections. By default this is set to 5.

tolerance

tolerance for proximity variation on each iteration until obtaining the desired average number of connections. By default this is set to 0.05.

compute

(Type: character) the proximity to compute. By default this is "both" (both projections) but it can also be "country" or "product".

Value

A list of two graphs.

Details

The current implementation follows (Hausmann et al. 2014) to create simplified graphs that correspond to a simplification of the proximity matrices. The result is obtained by iterating and reducing links until the desired average number of links per node is obtained, or a spaning tree after the strongest links is returned when is not possible to return the desired network.

References

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.

Examples

net <- projections(
  economiccomplexity_output$proximity$proximity_country,
  economiccomplexity_output$proximity$proximity_product,
  avg_links = 10,
  tolerance = 0.1
)
#> computing country projection...
#> --------------------------------------------------
#> 0 threshold...
#> 0.1 threshold...
#> 0.2 threshold...
#> 0.3 threshold...
#> 0.4 threshold...
#> 0.5 threshold achieves the avg number of connections
#> computing product projection...
#> --------------------------------------------------
#> 0 threshold...
#> 0.1 threshold...
#> 0.2 threshold...
#> 0.3 threshold...
#> 0.4 threshold...
#> 0.5 threshold...
#> 0.6 threshold achieves the avg number of connections

# partial view of projections
igraph::E(net$network_country)[1:5]
#> + 5/478 edges from 037096c (vertex names):
#> [1] zaf--zwe tza--zmb tza--uga tuv--wlf tuv--umi
igraph::E(net$network_product)[1:5]
#> + 5/1339 edges from 9accf38 (vertex names):
#> [1] 8981--8982 8946--9510 8922--8932 8921--8922 8852--8959