egttools.plotting.helpers.calculate_nb_states

calculate_nb_states()

Calculates the number of possible states in a discrete simplex.

This corresponds to the number of integer compositions of a population of size group_size into nb_strategies categories. Internally, it uses the “stars and bars” combinatorial formula.

Parameters:
  • group_size (int) – Size of the population or group (number of “stars”).

  • nb_strategies (int) – Number of available strategies (number of “bins”).

Returns:

The number of possible integer states of the simplex, i.e., the number of ways to assign group_size individuals to nb_strategies strategies.

Return type:

int

Examples

>>> calculate_nb_states(4, 3)
15
>>> calculate_nb_states(10, 2)
11