Type: | Package |
Title: | Market Structure, Concentration and Inequality Measures |
Version: | 0.1.6 |
Description: | Based on individual market shares of all participants in a market or space, the package offers a set of different structural and concentration measures frequently - and not so frequently - used in research and in practice. Measures can be calculated in groups or individually. The calculated measure or the resulting vector in table format should help practitioners make more informed decisions. Methods used in this package are from: 1. Chang, E. J., Guerra, S. M., de Souza Penaloza, R. A. & Tabak, B. M. (2005) "Banking concentration: the Brazilian case". 2. Cobham, A. and A. Summer (2013). "Is It All About the Tails? The Palma Measure of Income Inequality". 3. Garcia Alba Idunate, P. (1994). "Un Indice de dominancia para el analisis de la estructura de los mercados". 4. Ginevicius, R. and S. Cirba (2009). "Additive measurement of market concentration" <doi:10.3846/1611-1699.2009.10.191-198>. 5. Herfindahl, O. C. (1950), "Concentration in the steel industry" (PhD thesis). 6. Hirschmann, A. O. (1945), "National power and structure of foreign trade". 7. Melnik, A., O. Shy, and R. Stenbacka (2008), "Assessing market dominance" <doi:10.1016/j.jebo.2008.03.010>. 8. Palma, J. G. (2006). "Globalizing Inequality: 'Centrifugal' and 'Centripetal' Forces at Work". 9. Shannon, C. E. (1948). "A Mathematical Theory of Communication". 10. Simpson, E. H. (1949). "Measurement of Diversity" <doi:10.1038/163688a0>. |
License: | GPL (≥ 3) |
URL: | https://github.com/ropensci/concstats/, https://docs.ropensci.org/concstats/ (website) |
BugReports: | https://github.com/ropensci/concstats/issues/ |
Depends: | R (≥ 2.10) |
Suggests: | rmarkdown, knitr, dplyr, devtools, kableExtra, ggplot2, testthat (≥ 3.0.0), covr |
VignetteBuilder: | knitr, rmarkdown |
Encoding: | UTF-8 |
Language: | en-US |
LazyData: | true |
RoxygenNote: | 7.2.3 |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2023-03-30 19:57:49 UTC; Acer |
Author: | Andreas Schneider |
Maintainer: | Andreas Schneider <schneiderconsultingpy@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-03-30 20:20:03 UTC |
A wrapper for the proposed concentration measures
Description
A wrapper for the proposed concentration measures
Usage
concstats_all_comp(x, normalized = FALSE, na.rm = TRUE, digits = NULL)
Arguments
x |
A non-negative numeric vector. |
normalized |
Logical. Argument specifying whether or not a normalized
value is required. Must be either |
na.rm |
A logical vector that indicates whether |
digits |
A non-null value for digits specifies the minimum number of
significant digits to be printed in values. The default is |
Details
concstats_all_comp
returns all proposed group measures in a one step
procedure with default settings if not otherwise specified.
Value
A data.frame
.
See Also
concstats_all_mstruct()
, concstats_all_inequ()
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
concstats_all_comp(x, digits = 2)
A wrapper for the proposed inequality measures
Description
A wrapper for the proposed inequality measures
Usage
concstats_all_inequ(x, normalized = FALSE, na.rm = TRUE, digits = NULL)
Arguments
x |
A non-negative numeric vector. |
normalized |
Logical. Argument specifying whether or not a normalized
value is required. Must be either |
na.rm |
A logical vector that indicates whether |
digits |
A non-null value for digits specifies the minimum number of
significant digits to be printed in values. The default is |
Details
concstats_all_inequ
returns all proposed group measures in a one step
procedure with default settings if not otherwise specified.
Value
A data.frame
.
See Also
concstats_all_mstruct()
, concstats_all_comp()
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
concstats_all_inequ(x, digits = 2)
A wrapper for the proposed structural measures
Description
A wrapper for the proposed structural measures
Usage
concstats_all_mstruct(x, na.rm = TRUE, digits = NULL)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
digits |
A non-null value for digits specifies the minimum number of
significant digits to be printed in values. The default is |
Details
concstats_all_mstruct
returns all proposed group measures in a
one step procedure with default settings if not otherwise specified.
Value
A data.frame
.
See Also
concstats_all_comp()
, concstats_all_inequ()
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_all_mstruct(x, digits = 2)
Group of Concentration Measures
Description
A set of different concentration measures.
Usage
concstats_comp(x, normalized = FALSE, type = c("hhi", "hhi_d", "hhi_min",
"dom", "sten", "all"), na.rm = TRUE, digits = NULL)
Arguments
x |
A non-negative numeric vector. |
normalized |
Logical. Argument specifying whether or not a normalized
value is required. Ranges from (0, 1) and often used for comparison over
time. Must be either |
type |
A character string of the measure to be calculated, can be abbreviated with the first letter. Defaults to "hhi". Input is not case-sensitive. |
na.rm |
A logical vector that indicates whether |
digits |
A non-null value for digits specifies the minimum number of
significant digits to be printed in values. The default is |
Details
concstats_comp
is a wrapper for the proposed concentration measures
concstats_hhi()
, concstats_hhi_d()
, concstats_dom()
,
concstats_hhi_min()
, concstats_sten()
, concstats_all_comp()
.
If no measure is specified "hhi" will be the default.
concstats_hhi
, can be calculated individually as a normalized
measure changing the default setting to TRUE
.
concstats_all_comp
computes all measures in a one step procedure.
For more details or references please see the help page of the respective
function.
Value
A single numeric measure in decimal form or data frame
.
Note
The vector of market shares should be in a decimal form corresponding to total shares of individual firms/units. The vector should sum up to 1.
See Also
concstats_concstats()
, concstats_mstruct()
, concstats_inequ()
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
# the Herfindahl-Hirschman index of the vector
concstats_comp(x, type = "hhi")
# individual measure
concstats_sten(x)
# complete group measures
concstats_comp(x, type = "all", digits = 2)
A set of Market Structure, Concentration, and Inequality Measures
Description
A convenience function which calculates a selected set of different market structure, inequality and concentration measures more or less commonly used, e.g. k-firm ratios, Entropy, HHI, Palma ratio, and others in a one step procedure to provide a first overview.
Usage
concstats_concstats(x, na.rm = TRUE, digits = NULL)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
digits |
A non-null value for digits specifies the minimum number of
significant digits to be printed in values. The default is |
Details
concstats_concstats
computes a set of different and selected
structural, inequality, and concentration measures in a one step procedure.
The resulting data frame
contains eight measures: number of firms with
market share, numbers equivalent, the cumulative share of the top
(top 3 and top 5) firm(s) in percentage, the hhi index, the entropy index,
and the palma ratio. However, all measures can be computed individually or
in groups.
Value
A data frame
of numeric measures with default settings.
Note
The vector of market shares should be in a decimal form corresponding to the total share of individual firms/units. The vector should sum up to 1.
See Also
concstats_mstruct()
, concstats_comp()
, concstats_inequ()
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
# a selected set of different structural, concentration, and inequality
# measures
concstats_concstats(x, digits = 2)
Dominance Index
Description
Dominance Index
Usage
concstats_dom(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Details
concstats_dom
calculates a dominance index, which measures the
concentration within the Herfindahl-Hirschman index, that is, the
concentration within the concentration.
Value
A single numeric measure in decimal form.
References
Garcia Alba Idunate, P. (1994). "Un Indice de dominancia para el analisis de la estructura de los mercados". El Trimestre Economico, 61: 499-524.
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
concstats_dom(x)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_dom(x, na.rm = FALSE)
Shannon Entropy
Description
Shannon Entropy
Usage
concstats_entropy(x, normalized = TRUE, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
normalized |
Logical. Argument specifying whether or not a normalized
value is required. Must be either |
na.rm |
A logical vector that indicates whether |
Value
A single numeric measure.
References
Shannon, C. E. (1948). "A Mathematical Theory of Communication", The Bell System Technical Journal (Nokia Bell Labs).
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_entropy(x, normalized = TRUE)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_entropy(x, na.rm = FALSE)
Number of firms
Description
Number of firms
Usage
concstats_firm(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
Logical vector that indicates whether |
Value
A positive numeric integer.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_firm(x)
Gini Index
Description
Gini Index
Usage
concstats_gini(x, normalized = TRUE, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
normalized |
Logical. Argument specifying whether or not a normalized
value is required. Must be either |
na.rm |
A logical vector that indicates whether |
Value
A single numeric measure.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_gini(x, normalized = TRUE)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_gini(x, na.rm = FALSE)
GRS measure
Description
GRS measure
Usage
concstats_grs(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
a logical vector that indicates whether |
Value
A single numeric measure in decimal form.
References
Ginevicius, R. and S. Cirba (2009). "Additive measurement of market concentration", Journal of Business Economics and Management, 10(3), 191-198.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_grs(x)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_grs(x, na.rm = FALSE)
Herfindahl-Hirschman Index
Description
Herfindahl-Hirschman Index
Usage
concstats_hhi(x, normalized = FALSE, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
normalized |
Logical. Argument specifying whether or not a normalized
value is required. Ranges from 0, 1 and often used for comparison over
time. Must be either |
na.rm |
A logical vector that indicates whether |
Details
concstats_hhi
calculates the widely used Herfindahl-Hirschman
Index (Herfindahl, 1950 and Hirschman, 1945). The index is calculated by
squaring the market share of each firm competing in the market and then
summing the resulting numbers.
Value
A single numeric measure in decimal form.
References
Herfindahl, O. C. (1950), "Concentration in the steel industry" (PhD thesis), Columbia University.
Hirschmann, A. O. (1945), "National power and structure of foreign trade". Berkeley, CA: University of California Press.
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
concstats_hhi(x)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_hhi(x, na.rm = FALSE)
Dual of the Herfindahl-Hirschman Index
Description
Dual of the Herfindahl-Hirschman Index
Usage
concstats_hhi_d(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Details
concstats_hhi_d
is the dual of the HHI index, which indicates
the percentage which represents the fraction of the banks that do not have
market participation.
Value
A single numeric measure in decimal form.
References
Chang, E. J., Guerra, S. M., de Souza Penaloza, R. A. & Tabak, B. M. (2005) Banking concentration: the Brazilian case. In Financial Stability Report. Brasilia: Banco Central do Brasil, 4: 109-129.
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
concstats_hhi_d(x)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_hhi_d(x, na.rm = FALSE)
Minimum of Herfindahl-Hirschman Index
Description
Minimum of Herfindahl-Hirschman Index
Usage
concstats_hhi_min(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Details
Calculates the minimum of the Herfindahl-Hirschman index, that is, the equivalent of all participants in the market with equal market shares.
Value
A single numeric measure in decimal form.
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
concstats_hhi_min(x)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_hhi_min(x, na.rm = FALSE)
Inequality and Diversity Measures
Description
A set of different inequality and diversity measures.
Usage
concstats_inequ(x, normalized = FALSE, type = c("entropy", "gini",
"simpson", "palma", "grs", "all"), na.rm = TRUE, digits = NULL)
Arguments
x |
A non-negative numeric vector. |
normalized |
Logical. Argument of the functions
|
type |
A character string of the measure to be calculated, defaults to
|
na.rm |
A logical vector that indicates whether |
digits |
A non-null value for digits specifies the minimum number of
significant digits to be printed in values. The default is |
Details
concstats_inequ
is a wrapper for the proposed inequality measures
concstats_entropy()
, concstats_gini()
,concstats_simpson()
,
concstats_palma()
,concstats_grs()
, concstats_all_inequ()
If no measure is specified, concstats_entropy
is the default.
concstats_entropy
returns the Shannon Entropy (Shannon, 1948),
concstats_gini
is the Gini coefficient. You can normalize the
Entropy and Gini measures by setting normalized = TRUE
concstats_palma
measures the ratio of inequality (normally used in
the context of measuring income inequality) of the top 10 percent to the
bottom 40 percent (Palma, 2006).
concstats_grs
is an alternative inequality measure (Ginevicius, 2009)
and
concstats_all_inequ
returns all measures in a one step procedure.
For more details or references please see the help page of the respective
function.
Value
The calculated numeric measure or a data frame
See Also
concstats_concstats()
,concstats_mstruct()
,concstats_comp()
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
# Calculate the Palma ratio
concstats_inequ(x, type = "palma")
# Calculate the entropy measure directly
concstats_entropy(x, normalized = TRUE)
# Calculate the group measures
concstats_inequ(x, type = "all", digits = 2)
Market Structure Measures
Description
Set of different market structure measures to reflect a given market structure.
Usage
concstats_mstruct(x, type = c("firm", "nrs_eq", "top", "top3", "top5",
"all"), na.rm = TRUE, digits = NULL)
Arguments
x |
A non-negative numeric vector. |
type |
A character string of the measure to be calculated, can be abbreviated with the first letter. Defaults to "firm". Input is not case-sensitive. |
na.rm |
A logical vector that indicates whether |
digits |
A non-null value for digits specifies the minimum number of
significant digits to be printed in values. The default is |
Details
concstats_mstruct
is a wrapper for the proposed structural measures
concstats_firm()
, returns the number of firms with a given market share
concstats_nrs_eq()
computes the reciprocal of the HHI, which indicates
the equivalent number of firms of the same size,
concstats_top()
, concstats_top3()
, and concstats_top5()
calculate the share of the top (top 3 and top 5) firm(s) and returns the
value in percentage. concstats_all_mstruct()
computes all measures in
a one step procedure. All measures can be computed individually.
Value
A single calculated numeric measure or data frame
.
Note
The vector of market shares should be in a decimal form corresponding to total share of individual firms/units.The sum of the vector should sum up to 1.
See Also
concstats_concstats()
,concstats_comp()
,concstats_inequ()
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
# the number of firms with market share
concstats_mstruct(x, type = "firm")
# Calculate top market share individually
concstats_top(x)
# Calculate the market structure group measures
concstats_mstruct(x, type = "all", digits = 2)
Numbers equivalent
Description
Numbers equivalent
Usage
concstats_nrs_eq(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Value
A positive numeric value.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_nrs_eq(x)
Palma ratio
Description
Palma ratio
Usage
concstats_palma(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Details
concstats_palma
measures the ratio of inequality (normally used with
income inequality) of the top 10 percent to the bottom 40 percent.
Value
A single numeric measure.
References
Palma, J. G. (2006). "Globalizing Inequality: 'Centrifugal' and 'Centripetal' Forces at Work", DESA Working Paper No. 35.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_palma(x)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_palma(x, na.rm = FALSE)
Gini-Simpson Index
Description
Gini-Simpson Index
Usage
concstats_simpson(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Details
concstats_simpson
is the Gini-Simpson index, also known as
the Gini impurity (Gini's diversity index) in Machine Learning, Gibbs-Martin
index or Blau index in sociology and management studies. This index ranges
from (0, 1).
Value
A single numeric value in decimal form.
References
Simpson, E. H. (1949). "Measurement of Diversity", Nature, 163, 688.
Jost, L. (2006). "Entropy and Diversity". Oikos, 113(2), 363-375.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_simpson(x)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_simpson(x, na.rm = FALSE)
Stenbacka Index
Description
Stenbacka Index
Usage
concstats_sten(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Details
concstats_sten
calculates the Stenbacka index,
which indicates the market share of a dominant position.
Value
A single numeric measure in decimal form.
References
Melnik, A., Shy, Oz, Stenbacka, R., (2008), "Assessing market dominance", Journal of Economic Behavior and Organization, 68: pp. 63-72.
Examples
# a vector of market shares
x <- c(0.35, 0.4, 0.05, 0.1, 0.06, 0.04)
concstats_sten(x)
# a vector with NA values
x <- c(0.4, 0.2, 0.25, 0.1, 0.05, NA)
concstats_sten(x, na.rm = FALSE)
Top market share
Description
Top market share
Usage
concstats_top(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Value
A positive numeric value, which indicates the top market share in percent.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_top(x)
Top 3 market share
Description
Top 3 market share
Usage
concstats_top3(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Value
A positive numeric value, which indicates the sum of the top 3 market shares as a percentage.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_top3(x)
Top 5 market share
Description
Top 5 market share
Usage
concstats_top5(x, na.rm = TRUE)
Arguments
x |
A non-negative numeric vector. |
na.rm |
A logical vector that indicates whether |
Value
A positive numeric value, which indicates the sum of the top 5 market shares as a percentage.
Examples
# a vector of market shares
x <- c(0.4, 0.2, 0.25, 0.1, 0.05)
concstats_top5(x)
Creditcoops
Description
data set with 22 paired Paraguayan credit cooperatives (2016, 2018)
Usage
creditcoops
Format
A data frame with 44 rows and 5 variables:
coop_id
double, ID of the credit cooperative
year
integer, sample year
total_loans
double, total loans granted (USD) per year and cooperative
paired
integer, paires of cooperatives
total_loans_log
double, the natural log of total loans
Note
real names of the cooperatives have been purposely omitted, but are available on request.
Author(s)
Andreas Schneider
Source
Examples
data("creditcoops")
head(creditcoops)