Diversity measures

The diversity module provides functions for measuring the diversity among quantities of groups in a population.

The quantity \(p_i\) represents the proportion of the population belonging to group \(i\).

voting.diversity.berger_parker(groups)[source]

Calculate the Berger-Parker index.

\[max(p_i)\]
Parameters

group (list) – a list of integers representing populations of groups

voting.diversity.general(groups, q=1)[source]

Calculate the general diversity index.

\[\left( \sum_{i=1}^n p_i^q \right) ^ {1/(1-q)}\]
Parameters
  • groups (list) – a list of integers representing populations of groups

  • q (float) – weight value

voting.diversity.gini_simpson(groups)[source]

Calculate the Gini-Simpson index.

\[1 - \sum_{i=1}^n p_i^2\]
Parameters

group (list) – a list of integers representing populations of groups

voting.diversity.golosov(groups)[source]

Calculate the effective number of parties using Golosov.

\[\sum_{i=1}^n \frac{p_i}{p_i + p_1^2 - p_i^2}\]

where \(p_1\) is the largest proportion.

Parameters

group (list) – a list of integers representing populations of a group

voting.diversity.inverse_simpson(groups)[source]

Calculate the Inverse-Simpson index.

\[\frac{1}{\sum_{i=1}^n p_i^2}\]
Parameters

group (list) – a list of integers representing populations of groups

voting.diversity.laakso_taagepera(groups)[source]

Calculate the effective number of parties using Laakso-Taagepera.

\[\frac{1}{\sum_{i=1}^n p_i^2}\]
Parameters

group (list) – a list of integers representing populations of groups

voting.diversity.renyi(groups, q=0)[source]

Calculate the Renyi entropy.

\[\frac{1}{1-q} \ln \left( \sum_{i=1}^n p_i ^ q \right)\]
Parameters
  • groups (list) – a list of integers representing populations of groups

  • q (float) – weight value

voting.diversity.shannon(groups)[source]

Calculate the Shannon index.

\[\sum_{i=1}^n p_i \ln (p_i)\]
Parameters

groups (list) – a list of integers representing populations of groups

voting.diversity.simpson(groups)[source]

Calculate the Simpson index.

\[\sum_{i=1}^n p_i^2\]
Parameters

groups (list) – a list of integers representing populations of groups