I am trying to calculate the HHI based on the number of vendors in a certain location by year. My data is arranged as below. Each row corresponds to the technology installed. The column “compcode” indicates the vendor installing the technology. The column “vdcname” indicates the location where the vendor installed the technology. “fiscal_year” is the year the technology was installed. The formula for the HHI = S12 + S22 + S32+ ……..+ Sn2, where Si = market share for a vendor. Therefore, Si relates to counting the distinct number of vendors and dividing it by the total count of vendors in that location for that particular year. Once we get that share of the market, then the rest is straightforward, which is squaring each Si and adding it up for the location for that year. The idea is if the HHI varies with the years and to get it as part of the data for each year.
copy starting from the next line ------ ----------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long vdcname float fiscal_year1 long compcode 1388 2006 168 1388 2013 96 1388 2013 96 1388 2013 96 2538 2006 168 2538 2007 168 2538 2013 96 2538 2013 96 2538 2013 96 2538 2013 96 2607 2007 168 2607 2007 168 1746 2012 96 1746 2012 96 1746 2012 96 1746 2013 96 1746 2013 96 1746 2013 96 1746 2013 96 end label values vdcname vdcname label def vdcname 1388 "Khewang", modify label def vdcname 1746 "Mehel", modify label def vdcname 2538 "Surumakhim", modify label def vdcname 2607 "Tel Lok", modify label values compcode compcode label def compcode 96 "MGC", modify label def compcode 168 "TPG", modify
Listed 19 out of 368945 observations
I would be much thankful for any help.
Samir
0 Response to Herfindahl-Hirschman Index (HHI)
Post a Comment