Gini

library(REAT)
# Market concentration (example from Doersam 2004):
sales <- c(20,50,20,10)
# sales turnover of four car manufacturing companies
g=gini (sales, lc = TRUE, lcx = "percentage of companies", lcy = "percentrage of sales",
      lctitle = "Lorenz curve of sales", lcg = TRUE, lcgn = TRUE)

# returs the non-standardized Gini coefficient (0.3) and
# plots the Lorenz curve with user-defined title and labels
gstar=gini (sales, coefnorm = TRUE)
# returns the standardized Gini coefficient (0.4)
# Income classes (example from Doersam 2004):
income <- c(500, 1500, 2500, 400000, 7500, 15000)
g2=gini (income, lc = TRUE, lcx = "classes", lcy = "percentrage of income",
        lctitle = "Lorenz curve of income", lcg = TRUE, lcgn = TRUE)

g2
## [1] 0.7974239
pib <-c(103742,
        406927,
        29900,
        424820,
        70973,
        80145,
        42829,
        35294,
        109735,
        141946,
        267103,
        575405,
        78138,
        61111,
        373367,
        354425,
        1987357
)
g3=gini (pib, lc = TRUE, lcx = "classes", lcy = "percentrage of pib",
         lctitle = "Lorenz curve of pib", lcg = TRUE, lcgn = TRUE)

g3
## [1] 0.5927171

HHI

herf(sales) # HHI - Herfindahl-Hirschman Index
## [1] 0.34
herf(sales,coefnorm = T)
## [1] 0.12
herf(pib,coefnorm = F)
## [1] 0.1902012