egttools.precompute_group_to_state_indicator_matrix

precompute_group_to_state_indicator_matrix()

Build a state-level indicator matrix from group-level callables.

Converts group-level indicators f_k(group_config) to a state-level matrix by marginalising over group configurations using the multivariate hypergeometric distribution:

indicator_values(s, k) = sum_g P(g | s) * f_k(g)

where P(g | s) is the multivariate hypergeometric probability. The returned matrix can be passed directly to calculate_expected_state_indicators_precomputed or to PairwiseComparisonNumerical.estimate_stationary_indicators.

For group_size == 2, pairwise probabilities are computed with simple combinatorics instead of the full hypergeometric formula.

Parameters:
  • pop_size (int) – Total number of individuals in the population.

  • group_size (int) – Number of individuals sampled per group interaction.

  • nb_strategies (int) – Number of strategies available in the population.

  • indicators (list[callable]) – Group-level indicator functions, each mapping a group configuration (list[int], sums to group_size) to a float.

Returns:

Dense matrix of shape (nb_states, len(indicators)).

Return type:

numpy.ndarray