Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Computing Herfindahl-Hirschman index


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Computing Herfindahl-Hirschman index
Date   Wed, 8 Dec 2010 12:20:24 +0000

The (minor) bad news is that the data structure here is not helpful for this purpose, as Antoine Terracol implies in his reply, although the -reshape- is one line. 

The good news is that this beast has often been programmed, often under a different name. It, or its complement in 1, is also known (e.g.) as Simpson's index, especially in ecology, as heterozygosity and as one of several things called the Gini index. Invoking the name Herfindahl gets nods in economics, but he was not the first discoverer. (Hirschman as I recall proposed not this formula, but something else.) 

Using e.g. -ineq- from SSC I imagine code like this: 

reshape long item, i(importer) 
ineq item, by(importer) gensim(herfindahl) 

You can -reshape- back if desired. 

Nick 
n.j.cox@durham.ac.uk 

Syed Basher

I have the following (hypothetical) trade dataset which contains imported items by importer.

importer  | item1 item2..... item20
-----------------------------------
11        |  10      20        80 
12        |   5       7         9 
13        |           1        
14        |   2                 6
...       |
20        |   8       9

I would like to obtain the following table/data: 

importer  | item1      item2   .... item20
-------------------------------------------
11        |  1600     2921.84       7091.41 
12        |   400      357.92         89.75
13        |              7.30        
14        |    64                     39.88
...       |
20        |  1024      591.67


where, say, the value 1600 is obtained using the formula (si*100)^2, where si is the share of importer11 in item1 and is obtained using 10/25,   25 is the sum of all entries in item1. This will allow me to get the  Herfindahl-Hirschman index by importer for each item.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index