Skip to contents

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 concstats_entropy, concstats_gini specifying whether or not a normalized value is required. Ranges from (0, 1) and often used for comparison over time. Must be either TRUE or FALSE. The default is FALSE.

type

A character string of the measure to be calculated, defaults to concstats_entropy. Input is not case-sensitive.

na.rm

A logical vector that indicates whether NA values should be excluded or not. If set to FALSE the computation yields NA if vector contains NA values. Must be either TRUE or FALSE. The default is TRUE.

digits

A non-null value for digits specifies the minimum number of significant digits to be printed in values. The default is NULL and will use base R print option. Significant digits defaults to 7.

Value

The calculated numeric measure or a data frame

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.

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")
#> [1] 2.666667
# Calculate the entropy measure directly
concstats_entropy(x, normalized = TRUE)
#> [1] 0.879203
# Calculate the group measures
concstats_inequ(x, type = "all", digits = 2)
#>         Measure Value
#> 1       Entropy  2.04
#> 2    Gini Index  0.34
#> 3 Simpson Index  0.72
#> 4   Palma Ratio  2.67
#> 5           GRS  0.40