H | R Documentation |
Calculates heterogeneity from a frequency vector.
H(Z)
Z |
Frequency vector |
This function implements Fearon's (2003) measure of heterogeneity, also known as the Herfindahl Index or the Herfindahl-Hirschman Index. Specify a frequency vector, which can be created using prop.table
. A frequency vector describes the size of each group as a proportion of the overall population. For instance, of there are three groups in a population, A with 60% of the population, B with 30% of the population, and C with 10% of the population, the corresponding frequency vector is c(0.6, 0.3, 0.1)
. Heterogeneity is calculated as H=\sum_{i=1}^{k}p_i^2
.
Level of heterogeneity
Didier Ruedin
Fearon, J. (2003) Ethnic and cultural diversity by country. Journal of Economic Growth 8:195-222. <DOI: 10.1023/A:1024419522867>
# using prop.table() to create a frequency vector
V <- c(1,1,1,1,1,1,3,3,3,3,4,5,5,5,5)
H(prop.table(V))
# special cases
H(prop.table(c(1,0,0)))
H(prop.table(c(.99,0.01,0)))
H(prop.table(c(.9,0.1,0)))
H(prop.table(c(.8,0.1,0.1)))
H(prop.table(c(1,1,1)))
H(prop.table(c(1,1,1,1)))
H(prop.table(c(1,1,1,1,1,1,1,1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.