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. All measures can be accessed individually.

  • concstats_entropy() returns the Shannon entropy. concstats_entropy You can normalize the entropy measures by setting normalized = TRUE.

  • concstats_gini() calculates the gini coefficient. concstats_gini You can normalize the gini measures by setting normalized = TRUE.

  • concstats_simpson() calculates the gini-simpson index.

  • concstats_palma() calculates the palma ratio of inequality.

  • concstats_grs() calculates an alternative concentration measure.

  • 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