Calculate Herfindahl-Hirschman Index In R

The Herfindahl-Hirschman Index (HHI) is a widely used measure of market concentration. The HHI is calculated by squaring the market share of each firm in the industry and summing the result:

HHI = s1^2 + s2^2 + s3^2 + ... + sn^2 where s is the market share of each firm.

The HHI is used as a measure of competition, with 10,000 meaning perfect monopoly (100^2) and 0.0 meaning perfect competition.

As per Investopedia - The U.S. Department of Justice considers a market with an HHI of less than 1,500 to be a competitive marketplace, an HHI of 1,500 to 2,500 to be a moderately concentrated marketplace, and an HHI of 2,500 or greater to be a highly concentrated marketplace.

Let's take an example of Auto Ancillaries sector of listed Indian companies. In this example, I have taken Net sales figures that are in Rs. million in a quarter of Sep 2017.

Company NameNet Sales% of Sales
AMARA RAJA BATT.14,27511%
ASAHI INDIA6,2475%
AUTO CORP. OF GOA1,4211%
AUTOMOTIVE AXLES3,4963%
BHARAT FORGE12,58010%
BOSCH LTD28,11922%
CARBORUNDUM UNIVERSAL5,8715%
EXIDE INDUSTRIES23,71319%
MUNJAL SHOWA4,1533%
NRB BEARINGS2,0822%
SCHAEFFLER INDIA LTD4,9224%
SKF INDIA6,7985%
SONA KOYO STEER3,0282%
TIMKEN INDIA3,1022%
WABCO INDIA6,0985%
ZF STEERING1,0991%

The % share is calculated and data saved in txt format. The data files are shared with you along with the code.

The headings of data columns being Company Name and Sep.2017.

In R let’s import the package HHI and import this data.

  1. install.packages('hhi')  
  2. library(hhi)  
  3. autoanc <- read.table('E:\\Veena\\HHI Example.txt', sep = "\t", header = T)  
  4. # The HHI is used as a measure of competition, with 10,000 meaning  
  5. # perfect monopoly (100^2) and 0.0 meaning perfect competition.  
  6. hhi(autoanc,"Sep.2017")  
You see a result of 1214 which means this is a fairly competitive marketplace in India. And we have taken only listed entities and ignored non-listed ones (only due to lack of reasonable data available publicly). You can easily cross-check the result in excel by applying the formula.

Now, let’s measure this result over several years and see the competitive behavior of this sector of the Indian industry.

The code for this part is in the attached code file. Please note that plot_hhi is a relatively inflexible function meant for the quick visual rendering of a vector of HHI values over a period of time. Instead, ggplot2 allows for greater flexibility in customizing visual output. 
 
 
 
As can be seen, Herfindahl-Hirschman Index (HHI), gives a pretty clear picture on how this particular auto ancillary sector of an industry was fragmented earlier and now consolidated within few players. Key to be noted is that data should be correct.
 
This code can also be written by writing your own function instead of using the HHI package. 


Similar Articles