# The Diversity Calculator

Instructions
The diversity calculator computes the entropy of a system composed of groups where each element/agent/person in the system can be classified into a distinct group. The calculator could be used to compute the ethnic diversity among the employees of a company for instance, where each ethnic category is one group. Higher numbers indicate greater diversity.

Use the scrollbars to input the size of each group in the system you are evaluating. The diversity calculator can evaluate systems with up to 8 groups. If your system has fewer than 8 groups, just leave the other scrollbars at 0.

The overall diversity of a system is based on the number of groups and the number of elements in each group. The minimum value (0.0) indicates a homogenous society where all elements are classified in the same group. The maximum entropy for an 8 group system is 3.0. This occurs when there are an equal number of elements in each group.

It is sometimes useful to normalize results so that the diversity measure varies from 0.0 to 1.0. An entropy value normalized for the number of groups is provided in the second row.

In addition to entropy and normalized entropy, the calculator also computes the probability that any two elements picked at random come from the same group (with replacement). This is called Meyer's Index because it is closely related to the index of ethnic diversity developed by Meyer and McIntosh (see references below).

Example use
Suppose you were interested in comparing the racial diversity of students at several universities. Assume the universities provide you with information on the number of black, asian, white and native american students at their schools. The data can be entered directly into the calculator, or converted to percentages first. Since the calculator only provides for up to 100 elements in each group, it may be necessary to convert the values to percentages. This conversion does not impact the resulting diversity calculation. Here are some example numbers:

 black asian white native College A 70% 20% 9% 1% College B 15% 25% 50% 10% College C 1% 97% 1% 1% College D 25% 25% 25% 25%
Example data

Since we know in advance that all students will fall into one of four groups, we can use the normalized value. This will ensure that the measured diversity value falls between 0 (minimum diversity) and 1.0 (maximum diversity).

Finally, for each university, enter the percentages as the number of elements in each group on the scrollbars for groups 1 through 4. The results are:

 black asian white native normalized diversity College D 25% 25% 25% 25% 1.00 College B 15% 25% 50% 10% 0.87 College C 70% 20% 9% 1% 0.60 College A 1% 97% 1% 1% 0.12
Example results

Bugs
In old implementations of the Java Virtual Machine the scrollbars only allow 0-99 elements in a group instead of 0-100, and normalization for 2 to 7 groups instead of 2 to 8.

Background information
The social entropy metric was developed by Tucker Balch as a way to evaluate the diversity of learning robot teams.

Social entropy is based on Claude Shannon's information entropy. For more details on social entropy, please consult the thesis: Behavioral Diversity in Learning Robot Teams.

For details on Meyer's Index see: Meyer, Philip and Shawn McIntosh (1992): "The USA Today Index of Ethnic Diversity," International Journal of Public Opinion Research. Spring, p. 56.