egttools.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:
- 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:
Examples
>>> calculate_nb_states(4, 3) 15
>>> calculate_nb_states(10, 2) 11