homogeneity | R Documentation |
Calculate a simple index of homogeneity for nominal data, that is variously called Simpson's, Herfindahl's or Hirschman's index.
homogeneity(x, reverse = F, summary = F)
x |
(a vector) A vector of values. |
reverse |
(log scalar) Whether to reverse the index to index heterogeneity (default false). |
summary |
(log scalar) Whether to treat data as summary statistics of the group proportions (default false). If data are given in 0-100 format, it will automatically convert. |
homogeneity(iris$Species)
homogeneity(iris$Species, reverse = T)
homogeneity(c(.7, .2, .1), summary = T)
homogeneity(c(80, 15, 5), summary = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.