egttools.calculate_strategies_distribution¶
- calculate_strategies_distribution()¶
Calculates the average frequency of each strategy given a stationary distribution.
This method computes the average strategy frequencies in the population based on the stationary distribution over all population states. It is assumed that the stationary distribution is sparse.
- Parameters:
pop_size (int) – Total number of individuals in the population.
nb_strategies (int) – Number of strategies available in the population.
stationary_distribution (scipy.sparse.csr_matrix) – Sparse matrix representing the stationary distribution over population states.
- Returns:
A 1D NumPy array of shape (nb_strategies,) containing the average frequency of each strategy across all states in the stationary distribution.
- Return type:
NDArray[np.float64]
See also
egttools.calculate_state
,egttools.sample_simplex
,egttools.calculate_nb_states
,egttools.numerical.PairwiseComparisonNumerical.estimate_stationary_distribution_sparse
Examples
>>> from scipy.sparse import csr_matrix >>> freq = calculate_strategies_distribution(10, 3, csr_matrix(...)) >>> freq.shape (3,)