Calculating Market Concentration Indices in R – I


Market in present day can be thought of  as dynamic and continuously evolving  in its form and structure. As students of economics we study markets broadly in three different form i.e. perfect competition, monopolistic competition and oligopoly.  Monopolistic markets are markets with few sellers and high degree of power with the seller. The seller under monopolistic market has the power to dictate the price.

Studying the market concentration of an industry allows us to assess the degree to which the seller would have the power to control the price. Some of the prominent measures used to estimate the market concentration are :

  1. Herfindahl-Hirschman Index (HHI)
  2. Horvath Index
  3. Entropy Index
  4. Ginevicius Index

In the present article we will learn how to calculate these indices in R and also study their limitations.

HHI Index:

HHI index is the most widely used index for calculating market concentration.  Rhoades (1993)  states that the HHI can also be used to study concentration in various aspects for example to study the concentration of income/ wealth in U.S. households, degree of concentration of output of firms in banking or industrial markets and it is also used by U.S. Justice Department  and Federal Reserve to analyze the effect of horizontal mergers. The HHI is calculated using the following equation:

HHI = \sum_{i=1}^{n} {S_{i}}^{2}

Where {S_{i}} is the market share of the i firm in an industry. We note that as the number of firms in an industry increases the HHI will decline. A competitive market with large number of firms will have HHI closer to 0.  on the other hand a monopolistic market with only one firm will have the maximum HHI of 1.

In R we can calculate HHI using the hhi package. We will calculate the HHI using a simple example provided by Horvath (1970).  Let us assume that a hypothetical industry comprises of a four firms with market share of 50, 30, 15 and 5. The following R code can be used to calculate the HHI:

data = data.frame(firm =c("a","b","c","d"), mkt = c(50,30,15,5))
data %>% mutate(pct = mkt/sum(mkt))->data
hhi(data, "pct")

We get HHI of 0.3650 for our industry implying that the industry is moderately concentrated. It should be noted that as time passes an industry undergoes changes i.e. firms dissolve or get take over or new firm enters the market. Hence, it would be good to study the HHI over time. Mishra, Mohit & Parimal (2011) have compared various concentration measures for manufacturing industry in India over time.

The author of hhi package performs analysis of shoe industry from 2012 to 2017.  Following plot is generated using the code from authors github reposiroty.


The code used to generate the above plot is as follows:

library(hhi) #hhi package
library(dplyr) # data manipulation
# import the data:
footwear = read.table("footwear.txt", header = TRUE)
#create additional column to convert market share into percent
footwear %>% mutate(pct_12 = ms.2012/sum(ms.2012),
                    pct_13 = ms.2013/sum(ms.2013),
                     pct_14 = ms.2014/sum(ms.2014),
                      pct_15 = ms.2015/sum(ms.2015),
                       pct_16 = ms.2016/sum(ms.2016),
                      pct_17 = ms.2017/sum(ms.2017))-> footwear
# calculate hhi for each year
hhi.12 <- hhi(footwear, "pct_12")
hhi.13 <- hhi(footwear, "pct_13")
hhi.14 <- hhi(footwear, "pct_14")
hhi.15 <- hhi(footwear, "pct_15")
hhi.16 <- hhi(footwear, "pct_16")
hhi.17 <- hhi(footwear, "pct_17")
# combine the data into one data frame
hhi <- rbind(hhi.12, hhi.13, hhi.14, hhi.15, hhi.16, hhi.17)
year <- c(2012, 2013, 2014, 2015, 2016, 2017) <- data.frame(year, hhi)
# plot the data
plot_hhi(, "year", "hhi")


In the present blog post we did a a very quick overview of different concentration measures, its application and calculation methodology for HHI. In future posts we will study other concentration measures and their limitations.


  1. Rhoades, Stephen A. 1993. “The herfindahl-hirschman index.” Federal Reserve Bulletin 79: 188. Weblink-
  2. Horvath, Janos. “Suggestion for a Comprehensive Measure of Concentration.” Southern Economic Journal 36, no. 4 (1970): 446-52. doi:10.2307/1056855.
  3. MISHRA, PULAK, DIVESH MOHIT, and PARIMAL. “Market Concentration in Indian Manufacturing Sector: Measurement Issues.” Economic and Political Weekly 46, no. 49 (2011): 76-80.

One thought on “Calculating Market Concentration Indices in R – I

Add yours

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Built with

Up ↑

%d bloggers like this: