egttools.analytical.sed_analytical.replicator_equation_n_player¶
- replicator_equation_n_player(x, payoffs, group_size)[source]¶
Replicator dynamics in N-player games
The replicator equation is of the form
\[g(x) \equiv \dot{x_{i}} = x_{i}(f_{i}(x) - \sum_{j=1}^{N}{x_{j}f_{j}(x))\]Which can also be represented using a pairwise comparison rule as:
\[\dot{x_{i}} = x_{i}\sum_{j}(f_{ij}(x) - f_{ji}(x))x_{j}\]For N-player games, to calculate the fitness of a strategy given a population state, we need to calculate the probability of each possible group configuration. This can be obtained by summing for each possible group configuration the payoff of strategy i times the probability of the group configurations occurring.
- Parameters
x (numpy.ndarray) – A vector of shape (1, nb_strategies), which contains the current frequency of each strategy in the population.
payoffs (numpy.ndarray) – Payoff matrix. Each row represents a strategy and each column a possible group configuration. Each entry in the matrix should give the expected payoff for each row strategy for a given column group configuration.
group_size (int) – Size of the group.
- Returns
A vector of shape (1, nb_strategies), which contains the change in frequency of each strategy in the population (so the gradient).
- Return type