I have created the Stata commands below for my research on diversity, inequality, and segregation. The associated ado and help files can be downloaded for research and instructional purposes.
Finds Theil’s (1972) Entropy index for each observation or for a given group and saves it in a new variable.
Finds Theil's (1972) Information (H) index for all observations in the data set or within each bysort group.
Finds the Gini inequality index for observations within a particular sub-group and saves it in a new variable.
Finds the Segregation or Dissimilarity Index for all observations in the data set or within each bysort group.