5D Library › Evolutionary Game Theory, Direct and Indirect Reciprocity and the Emergence of Cooperation · 中文
Chapter 2 Hamilton’s Rule, the Price Equation and the Five Mechanisms
Kinship and rb > c
The conclusion of the last chapter was that in the randomly matched, one-shot anonymous donation game cooperators must lose out. To change that conclusion something must link a cooperator’s payoff to “who meets cooperators”. The first such link to be recognised was kinship.
Evidence
Hamilton’s rule. In 1964 Hamilton proposed that an act that costs the actor and gives the recipient a benefit is favoured by natural selection if
where is the coefficient of relatedness between them (for example 1/2 for full siblings, 1/4 for half siblings and 1/8 for first cousins). He called the sum of an individual’s own reproductive success and its effects on the reproduction of relatives, weighted by relatedness, inclusive fitness (Hamilton 1964).
Hamilton’s rule is often reduced to “helping relatives is helping your own genes”. The phrase is easily misread: the in the rule is not “the share of genes held in common” but a statistic; in its most general form it is the regression coefficient of the recipient’s genotype on the actor’s (Gardner et al. 2011). The clearest way to see this is through the Price equation.
The Price equation
Evidence
Covariance and selection. In 1970 Price gave an identity: the change in the mean value of a trait from one generation to the next equals the covariance between the trait and fitness (divided by mean fitness), plus a term for bias in transmission (Price 1970). In 1972 he extended the formula to hierarchically structured populations, splitting the change into a “between-group” and a “within-group” part (Price 1972).
Calculation
Let the population be divided into groups; in group let be the share of cooperators, the mean fitness and the change in the within-group share by the next generation. When all groups are the same size,
A positive first term means that groups with more cooperators reproduce more; a negative second term means that within each group cooperators reproduce less than defectors. The overall direction depends on which term is larger. At the level of individuals, if each cooperator pays and shares equally among the other members of its group, the share of cooperators rises if and only if
where indicates whether individual cooperates and is the share of cooperators among the others in its group. This is Hamilton’s rule in regression form: measures how much more likely a cooperator’s neighbours are to be cooperators than people in general, and it may come from kinship or from any process that brings similar individuals together.
Calculation
# The Price equation for a group-structured population, checked exactly. 20 groups of n
# = 10. Cooperators (z = 1) pay c = 1 and give b = 4 split among the other n - 1 group
# members. Fitness w = 1 + s * payoff, s = 0.05; offspring inherit z exactly (no
# transmission bias). Price (1972) splits the change in the cooperator share into a
# between-group covariance and the average within-group change:
# w_bar * dz_bar = Cov_g(W_g, p_g) + E_g(W_g * dp_g) (group weights equal)
# Hamilton's rule follows from the same covariance: z_bar rises iff r b > c, with the
# regression relatedness r = Cov(z_i, mean z of i's group-mates) / Var(z_i).
import random
rng = random.Random(3)
B, C, S, N_G, N = 4.0, 1.0, 0.05, 20, 10
def one_generation(groups):
W, P, dP = [], [], []
for g in groups:
k = sum(g)
w = [1 + S * (-C * z + B * (k - z) / (N - 1)) for z in g]
Wg = sum(w) / N; p = k / N
p_next = sum(wi * z for wi, z in zip(w, g)) / sum(w)
W.append(Wg); P.append(p); dP.append(p_next - p)
m = len(groups); wbar = sum(W) / m; pbar = sum(P) / m
pbar_next = sum(Wg * (p + d) for Wg, p, d in zip(W, P, dP)) / sum(W)
between = sum((Wg - wbar) * (p - pbar) for Wg, p in zip(W, P)) / m
within = sum(Wg * d for Wg, d in zip(W, dP)) / m
return pbar, pbar_next, between / wbar, within / wbar
def relatedness(groups):
zs = [z for g in groups for z in g]; mu = sum(zs) / len(zs)
var = sum((z - mu) ** 2 for z in zs) / len(zs)
cov = sum((z - mu) * ((sum(g) - z) / (N - 1) - mu) for g in groups for z in g)
cov /= len(zs)
return cov / var
def make(spread):
"""Group cooperator counts drawn around 5 with a given spread (assortment)."""
groups = []
for _ in range(N_G):
k = min(N, max(0, round(5 + spread * rng.gauss(0, 1))))
groups.append([1] * k + [0] * (N - k))
return groups
err = 0.0
print("spread r(regr.) r*b - c change in p between within within each group")
for spread in (0.0, 1.0, 2.0, 3.0, 4.0, 6.0):
gs = make(spread)
p0, p1, bt, wi = one_generation(gs)
r = relatedness(gs)
err = max(err, abs(p1 - p0 - bt - wi))
mixed = [g for g in gs if 0 < sum(g) < N]
falls = all(one_generation([g])[3] < 0 for g in mixed)
print(f"{spread:5.1f} {r:+.3f} {r * B - C:+.3f} {p1 - p0:+.6f}"
f" {bt:+.6f} {wi:+.6f}"
f" {'falls' if falls else 'mixed'} ({len(mixed)} mixed groups)")
print(f"largest |change - (between + within)| over the six rows: {err:.1e}")
# spread r(regr.) r*b - c change in p between within within each group
# 0.0 -0.111 -1.444 -0.016796 +0.000000 -0.016796 falls (20 mixed groups)
# 1.0 -0.071 -1.282 -0.014917 +0.001275 -0.016192 falls (20 mixed groups)
# 2.0 +0.156 -0.378 -0.004315 +0.008229 -0.012544 falls (19 mixed groups)
# 3.0 +0.208 -0.170 -0.001962 +0.009963 -0.011925 falls (16 mixed groups)
# 4.0 +0.356 +0.422 +0.004910 +0.014651 -0.009742 falls (14 mixed groups)
# 6.0 +0.515 +1.062 +0.012344 +0.019669 -0.007325 falls (11 mixed groups)
# largest |change - (between + within)| over the six rows: 6.4e-17The program builds 20 groups of 10, in each of which the number of cooperators fluctuates at random around 5; “spread” controls the size of the fluctuations, that is, the size of the differences between groups. Every row shares one fact: within every mixed group the share of cooperators falls (last column). But the change in the overall share depends on the differences between groups. With spread 0 every group has exactly 5 cooperators, the regression relatedness is (each cooperator’s group-mates include fewer cooperators than average, a consequence of sampling in finite groups), and the overall share falls by 0.0168; with spread 4, and , the positive between-group term (+0.0147) outweighs the negative within-group term (−0.0097), and the overall share rises by 0.0049. In all six rows the sign of matches the sign of the overall change exactly, and the two terms of the decomposition add up to the actual change to within , the computer’s rounding error.
This is an example of Simpson’s paradox: cooperators decline within every group, yet increase in the population as a whole.
Note
An identity, not a causal model. The Price equation is a mathematical identity that any generation’s data satisfy; it tells us how to keep the accounts, not how groups form or whether the differences between groups will persist into the next generation. Hamilton’s rule in regression form likewise always “holds”, because , and are all defined by regressions; its explanatory power depends on whether those regression coefficients are stable. This point recurs throughout the dispute over inclusive fitness (Gardner et al. 2011).
Nowak’s five mechanisms
Evidence
Five rules. In 2006 Nowak summarised the mechanisms for the evolution of cooperation in Science under five headings, and showed that each can be written as “the benefit-to-cost ratio must exceed a threshold”: kin selection ; direct reciprocity ( the probability that the same two individuals meet again); indirect reciprocity ( the probability of knowing someone’s reputation); network reciprocity ( the average number of neighbours per individual); group selection ( the maximum group size, the number of groups) (Nowak 2006). The paper compares cooperation and defection by three criteria: whether cooperation is an ESS, whether it is “risk-dominant”, and whether it is favoured by the one-third law in finite populations.
Calculation
# Nowak's (2006) five thresholds, each recomputed from its own model. Every rule has the
# form b/c > critical value, but the models and assumptions differ (see the text).
# Direct reciprocity: TFT vs ALLD, w = probability of another round. Row payoffs:
# TFT vs TFT (b - c)/(1 - w), TFT vs ALLD -c, ALLD vs TFT b, ALLD vs ALLD 0.
# Indirect reciprocity: discriminators know a reputation with probability q:
# DISC vs DISC b - c, DISC vs ALLD -c (1 - q), ALLD vs DISC b (1 - q), ALLD vs ALLD 0.
# For a 2 x 2 game [[a, b'], [c', d]] (cooperative strategy first): cooperation is an
# ESS if a > c', risk-dominant if a + b' > c' + d, and favoured by weak selection in a
# large population (one-third law) if a + 2b' > c' + 2d.
def conditions(M):
(a, b, c, d) = M
return a > c, a + b > c + d, a + 2 * b > c + 2 * d
def crit(make, lo=1.0001, hi=60.0):
"""Smallest b/c (c = 1) at which each of the three conditions holds, by bisection."""
out = []
for k in range(3):
l, h = lo, hi
if not conditions(make(h))[k]: out.append(float("inf")); continue
for _ in range(60):
m = (l + h) / 2
if conditions(make(m))[k]: h = m
else: l = m
out.append(h)
return out
print("direct reciprocity ESS risk-dominant one-third law")
for w in (0.5, 0.8, 0.9):
e, r, t = crit(lambda bc: ((bc - 1) / (1 - w), -1, bc, 0))
print(f" w = {w}: numeric {e:6.3f} {r:6.3f} {t:6.3f}")
print(f" formula {1 / w:6.3f} (1/w) {(2 - w) / w:6.3f} ((2-w)/w)"
f" {(3 - 2 * w) / w:6.3f} ((3-2w)/w)")
print("indirect reciprocity")
for q in (0.5, 0.8, 0.9):
e, r, t = crit(lambda bc: (bc - 1, -(1 - q), bc * (1 - q), 0))
print(f" q = {q}: numeric {e:6.3f} {r:6.3f} {t:6.3f}")
# Network reciprocity (Ohtsuki et al. 2006: death-birth updating, weak selection, k << N);
# exact value for vertex-transitive graphs of size N (Taylor, Day & Wild 2007).
print("network reciprocity, critical b/c: k (large N) vs (N - 2)/(N/k - 2)")
for k in (2, 4, 8):
print(f" k = {k}: " + " ".join(f"N={N}: {(N - 2) / (N / k - 2):6.2f}"
for N in (20, 50, 100, 1000)) + f" limit {k}")
print("kin selection 1/r: full sibs r = 1/2 -> 2, half sibs 1/4 -> 4, cousins 1/8 -> 8")
print("group selection 1 + n/m (Traulsen & Nowak 2006: weak selection, rare splitting):")
for n, m in ((10, 5), (10, 50), (30, 10)):
print(f" max group size n = {n}, m = {m} groups: {1 + n / m:.2f}")
# direct reciprocity ESS risk-dominant one-third law
# w = 0.5: numeric 2.000 3.000 4.000
# formula 2.000 (1/w) 3.000 ((2-w)/w) 4.000 ((3-2w)/w)
# w = 0.8: numeric 1.250 1.500 1.750
# formula 1.250 (1/w) 1.500 ((2-w)/w) 1.750 ((3-2w)/w)
# w = 0.9: numeric 1.111 1.222 1.333
# formula 1.111 (1/w) 1.222 ((2-w)/w) 1.333 ((3-2w)/w)
# indirect reciprocity
# q = 0.5: numeric 2.000 3.000 4.000
# q = 0.8: numeric 1.250 1.500 1.750
# q = 0.9: numeric 1.111 1.222 1.333
# network reciprocity, critical b/c: k (large N) vs (N - 2)/(N/k - 2)
# k = 2: N=20: 2.25 N=50: 2.09 N=100: 2.04 N=1000: 2.00 limit 2
# k = 4: N=20: 6.00 N=50: 4.57 N=100: 4.26 N=1000: 4.02 limit 4
# k = 8: N=20: 36.00 N=50: 11.29 N=100: 9.33 N=1000: 8.11 limit 8
# kin selection 1/r: full sibs r = 1/2 -> 2, half sibs 1/4 -> 4, cousins 1/8 -> 8
# group selection 1 + n/m (Traulsen & Nowak 2006: weak selection, rare splitting):
# max group size n = 10, m = 5 groups: 3.00
# max group size n = 10, m = 50 groups: 1.20
# max group size n = 30, m = 10 groups: 4.00The program starts from the payoff matrix of each mechanism, finds the threshold for each of the three criteria by bisection and compares it with the formula. In direct reciprocity, tit for tat plays always defect: two tit-for-tat players cooperate every round, with expected payoff ; tit for tat loses against always defect only in the first round; always defect gains against tit for tat only in the first round. Hence tit for tat is an ESS if , risk-dominant if , and favoured by the one-third law if . With the three are 2, 3 and 4: is the most lenient. The matrix for indirect reciprocity has the same structure with in place of , and the thresholds are the same.
The network threshold is the limit for large populations. For a finite network in which everyone has neighbours the exact threshold is (Taylor et al. 2007; Chen 2013): with it is 6.00 for , 4.26 for and 4.02 for . In small networks the threshold lies well above . The group-selection threshold approaches 1 when groups are many and small: 1.2 with 50 groups of 10, and 3 with 5 groups of 10.
Note
Five thresholds, five sets of assumptions. First, the five rules come from five different models, not from five special cases of one model, and they cannot simply be added or compared: saying “with direct reciprocity needs , with network reciprocity needs , so direct reciprocity is easier” is meaningless. Second, each model has its own conditions. Kin selection’s assumes that costs and benefits add up. Direct reciprocity’s compares only tit for tat and always defect, with no execution errors. Network reciprocity’s requires death–birth updating, weak selection and ; under birth–death updating a network never favours cooperation (Ohtsuki et al. 2006) (Chapter 5). Group selection’s requires weak selection and rare group splitting (Traulsen and Nowak 2006). Third, the “five mechanisms” are themselves a way of classifying and not an agreed one: many researchers regard kin selection and group selection as two mathematical descriptions of the same process, and different uses of the term “group selection” have caused long-standing confusion (West et al. 2007).
Evidence
The dispute over inclusive fitness. In 2010 Nowak, Tarnita and Wilson argued in Nature that inclusive fitness theory holds only under a few special conditions, that it is unnecessary for explaining the evolution of eusocial insects, and that it should be replaced by standard models of population genetics (Nowak et al. 2010). The next year Nature published a reply led by Abbot and signed by 137 authors, arguing that inclusive fitness theory has a sound mathematical foundation and extensive empirical support and that Nowak and colleagues had misunderstood it (Abbot et al. 2011). The dispute has not reached a consensus; this book uses Hamilton’s rule only as a consequence of the Price equation and takes no side.
Hypothesis · not established
Team-formation hypothesis (not yet established). The author conjectures that in an organisation where teams are formed project by project, whether cooperative behaviour (such as sharing resources unprompted) spreads through the organisation depends on the “regression relatedness” produced by the way teams are formed, that is, on how much more likely a cooperator’s teammates are to be cooperators than people in general, and not on the organisation’s slogans. A testable prediction is that where the team-formation rule can be randomised (for example in job rotation or on online collaboration platforms), units formed by self-selection show a higher share of cooperative behaviour after a period than randomly assigned units, and that the size of the difference is proportional to the within-team correlation in cooperative behaviour. If the two ways of forming teams do not differ, or the difference is unrelated to the within-team correlation, the hypothesis is refuted.
Chapter summary
Hamilton’s rule follows from the Price equation: when a cooperator’s neighbours are more likely to be cooperators, selection between groups can outweigh selection within groups, producing a Simpson’s paradox in which cooperation declines in every group but increases overall. Nowak grouped the mechanisms for the evolution of cooperation under five headings, each with a threshold for ; the thresholds come from different models resting on different assumptions, and both the five-way classification and the standing of inclusive fitness theory remain disputed. The next chapter looks closely at the most studied of the mechanisms: direct reciprocity.
References
Fan, Y. (2026). Evolutionary Game Theory, Direct and Indirect Reciprocity and the Emergence of Cooperation: From Hamilton's Rule and Axelrod's Tournaments to Reputation and Costly Punishment, Read Beside Classical Confucian and Mohist Ethics [演化博弈、直接与间接互惠及合作涌现的数学模型] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.23788551 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).