In 2019 I first launch a Complexity package on SSC which I detailed in this post.
The aim was to provide Stata users with an easy way to compute economic complexity indexes a la Hidalgo & Hausmann.
Since, the package greatly evolved, so I'll review here the major changes, and post some real-world example.
You can update it typing
To provide you with an example I took 2023 exports value by country/product (HS07 4 digits from BACI) in file Exports2023HS4d.dta attached
To compute the Economic Complexity Index, just run the following code (from the do-file also attached)
The lines of code below show some options
The ranking obtained is in line with the various rankings available online (here or there) with most complex economies being Switzerland, Japan, Korea and Germany.
I hope you'll have fun computing your own complexity scores from any specialization (exports, employment, innovation,...) ,at any scale or for any actor (countries, counties, firms,..)
Read the help-file for more info. A full article may follow.
Best,
Charlie
The aim was to provide Stata users with an easy way to compute economic complexity indexes a la Hidalgo & Hausmann.
Since, the package greatly evolved, so I'll review here the major changes, and post some real-world example.
You can update it typing
Code:
ssc install complexity,replace
- The package now offers two computational methods for Economic Complexity (Method of Reflections, and eigenvector method), and one derived metrics in the literature (Fitness index).
- The input doesn't need to be expressed in Revelead Comparative Advantage Tables, but can be written in any "performance" indicator across a set of activities (exports value, employment, ...)
- The table input can now be expressed as a varlist or using mata or Stata matrices.
- The package is now autonomous and no longer requires additional packages such as moremata to run
- The package offers additional metrics of relatedness to be computed such as coherence (index of intra-relatedness) or complexity outlook index (potential of complexity).
- The package also returns the adjacency matrices of the feature space (e.g. product space)
To provide you with an example I took 2023 exports value by country/product (HS07 4 digits from BACI) in file Exports2023HS4d.dta attached
To compute the Economic Complexity Index, just run the following code (from the do-file also attached)
Code:
reshape wide Xij, i(iso3) j(HS) /*first transform the list (long format) to a matrix of specialization (wide format)*/
*Then compute complexity:
complexity, varlist(Xij*)
The lines of code below show some options
Code:
complexity, varlist(Xij*) diversity outlook /*To compute diversity and Complexity Outlook Indices in addition to ECI*/
*To compute the same ECI index but using the method of reflection
complexity, varlist(Xij*) method(mr) iterations(40)
*To compute the fitness index
complexity, varlist(Xij*) method(fitness)
The ranking obtained is in line with the various rankings available online (here or there) with most complex economies being Switzerland, Japan, Korea and Germany.
I hope you'll have fun computing your own complexity scores from any specialization (exports, employment, innovation,...) ,at any scale or for any actor (countries, counties, firms,..)
Read the help-file for more info. A full article may follow.
Best,
Charlie