View source: R/dispersionIndex.R
| dispersionIndex | R Documentation | 
Calculate weighted versions of the Gini and Inoua (2021) indexes as originally defined in the econometric literature, using the half mean relative distance method.
dispersionIndex(
  x,
  index = "gini",
  w = rep(1, length(x)),
  weight.mean = TRUE,
  inverse = FALSE,
  max.cross = .Machine$integer.max,
  pb = FALSE
)
gini(...)
inoua(...)
x | 
 A vector of values  | 
index | 
 A character string, either   | 
w | 
 A vector of weights with the same length as   | 
weight.mean | 
 Logical. Should the mean values be weighted, or does the 
global depend exclusively on the observations? Default is   | 
inverse | 
 Logical. Should the value for the inverse weights be
calculated as well using binary decomposition? Default is   | 
max.cross | 
 When processing, what is the maximum number of rows that 
an internal data.table can have? This is generally not a concern unless
the number of observations approaches   | 
pb | 
 Logical. Should a progress bar be displayed? Default is   | 
... | 
 Parameters to pass on to   | 
A numeric of length 1 (if inverse = FALSE) or 2 (if inverse = TRUE)
representing the requested index.
Inoua, Sabiou (2021). "Beware the Gini Index! A New Inequality Measure." ESI Working Paper 21-18, https://digitalcommons.chapman.edu/esi_working_papers/355/.
# Generate dummy observations
x <- runif(10, 1, 100)
n <- runif(10, 0, 10)
# Calculate Gini index
gini(x)
# Calculate weighted Inoua index
inoua(x, w = n)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.