Jekyll2022-10-02T05:26:48+00:00https://nadiah.org/feed.xmlNadiah KristensenLab meeting about threshold games2022-08-01T04:44:54+00:002022-08-01T04:44:54+00:00https://nadiah.org/2022/08/01/dejaegher<p>Last month,
I chose <a href="https://www.nature.com/articles/s41598-020-62626-3">a paper by Kris De Jaegher in <em>Scientific Reports</em></a> for our
weekly <a href="https://ryanchisholm.com/">lab</a>-meeting discussion.
We used the paper to teach ourselves about threshold games,
and the purpose of this blog post is to summarise the things we learnt.</p>
<h3>Replicator dynamics revision</h3>
<p>De Jaegher used the replicator dynamics approach.
Replicator dynamics assumes a well-mixed, infinitely large population of players that reproduces asexually,
where the number of offspring they produce depends upon the payoff they receive from a game-theoretic ‘game’,
as illustrated below:–</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/800px-Game_Diagram_AniFin.gif">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/800px-Game_Diagram_AniFin.gif" alt="Replicator dynamics animation, created by HowieKor (Creative Commons)" />
</a>
<figcaption><span>Replicator dynamics animation, created by HowieKor (Creative Commons)</span></figcaption>
</figure>
<p>We start with a population of \(n\) individuals with different game strategies.
Individuals are randomly selected to form groups and play the game.
The payoff from the game determines how many offspring they have.
Offspring inherit the strategies of their parents (clonal reproduction), and the cycle repeats.</p>
<p>Let’s rederive the dynamics.
The number of individuals pursuing strategy \(i\) changes according to</p>
\[\frac{dn_i}{dt} = \dot{n_i} = n_i (\beta + f_i),\]
<p>where \(\beta\) is the background reproduction rate (apart from the game’s effect),
and \(f_i\) is the fitness effect of playing strategy \(i\).</p>
<p>Denote the proportion of \(i\)-strategists in the population</p>
\[p_i = \frac{n_i}{N}\]
<p>where \(N\) is the total population size.</p>
<p>We want to know \(\frac{dp_i}{dt}\).
Rearrange the \(p_i\) definition and take the derivatives</p>
\[n_i = p_i N\]
\[\dot{n_i} = p_i \dot{N} + \dot{p_i} N\]
\[\dot{p} = \frac{1}{N} (\dot{n_i} - p_i \dot{N})\]
<p>So we need to sort out \(\dot{N}\)</p>
\[\begin{align}
\dot{N} &= \sum_i \dot{n_i} \\
&= \beta \sum_i n_i + \sum_i f_i n_i \\
&= \beta N + N \sum_i f_i \frac{n_i}{N} \\
&= \beta N + N \sum_i f_i p_i \\
\dot{N} &= N (\beta +\bar{f}) \\
\end{align}\]
<p>Substitute our equations for \(\dot{N}\) and \(\dot{n_i}\) into the equation for \(\dot{p_i}\),
and we obtain the dynamics of strategy proportions</p>
\[\frac{dp_i}{dt} = \dot{p} = p_i (f_i - \bar{f})\]
<p>In the De Jaegher paper,
players face the binary choice of cooperating or defecting.
Denote cooperators and defectors by C and D, respectively,
and define \(p = p_C = 1-p_D\).
Then the equation governing the dynamics simplifies to</p>
\[\begin{align}
\dot{p}
&= p \, (f_C - [p f_C + (1-p) f_D]) \\
\dot{p} &= p (1-p) (f_C - f_D)
\end{align}\]
<h3>Threshold game</h3>
<p>In the threshold game, a group is formed with \(n\) players (different to \(n\)) above,
and if the group contains \(k\) or more cooperators,
then they provide a benefit \(b\).
The benefit $b$ is received by all group members regardless of whether that member was a cooperator or defector</p>
\[b_i =
\begin{cases}
b &\text{if } i >= k \text{ (threshold met)}\\
0 &\text{otherwise (threshold not met)}
\end{cases}\]
<p>Throughout their paper, they have normalised \(b=1\).</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
<span class="kn">from</span> <span class="nn">scipy.special</span> <span class="kn">import</span> <span class="n">binom</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="n">plt</span>
<span class="kn">from</span> <span class="nn">scipy.optimize</span> <span class="kn">import</span> <span class="n">brentq</span>
<span class="n">b</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">:</span> <span class="mi">1</span> <span class="k">if</span> <span class="n">x</span> <span class="o">>=</span> <span class="n">k</span> <span class="k">else</span> <span class="mi">0</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">5</span>
<span class="n">xV</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">7</span><span class="o">+</span><span class="mi">1</span><span class="p">))</span>
<span class="n">bV</span> <span class="o">=</span> <span class="p">[</span><span class="n">b</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">xV</span><span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'7 player game w. threshold $k=5$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xV</span><span class="p">,</span> <span class="n">bV</span><span class="p">,</span> <span class="s">'-o'</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'no. cooperators in group'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">'benefit $b$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xticks</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">7</span><span class="o">+</span><span class="mi">1</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/benefit_v_nocoops.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/benefit_v_nocoops.png" alt="Benefit provided to each player in the threshold game as a function of the number of cooperators in the group." />
</a>
<figcaption><span>Benefit provided to each player in the threshold game as a function of the number of cooperators in the group.</span></figcaption>
</figure>
<p>Everyone receives the benefit, but only cooperators pay the cost \(c\).
So the total payoff to cooperators is</p>
\[\text{cooperator payoff} =
\begin{cases}
b - c & \text{if threshold met,} \\
-c & \text{if threshold not met.}
\end{cases}\]
<p>and defectors receive</p>
\[\text{defector payoff} =
\begin{cases}
b & \text{if threshold met,} \\
0 & \text{if threshold not met.}
\end{cases}\]
<p>Defectors always do better than cooperators.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">5</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.4</span>
<span class="n">xV</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">))</span>
<span class="c1"># payoffs
</span><span class="n">pay_C</span> <span class="o">=</span> <span class="p">[</span> <span class="n">b</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="o">-</span> <span class="n">c</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">xV</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="p">]</span>
<span class="n">pay_D</span> <span class="o">=</span> <span class="p">[</span> <span class="n">b</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">xV</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xV</span><span class="p">[</span><span class="mi">1</span><span class="p">:],</span> <span class="n">pay_C</span><span class="p">,</span> <span class="s">'-o'</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'cooperators'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">xV</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">pay_D</span><span class="p">,</span> <span class="s">'-o'</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'red'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'defectors'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'7 player game w. threshold $k=5$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'best'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'no. of cooperators in group'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">'total payoff'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xticks</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/payoff_v_nocoops.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/payoff_v_nocoops.png" alt="Payoff to cooperators and defectors in the threshold game as a function of the number of cooperators in the group." />
</a>
<figcaption><span>Payoff to cooperators and defectors in the threshold game as a function of the number of cooperators in the group.</span></figcaption>
</figure>
<h3>Fitness effects</h3>
<p>The payoffs above tell us about what happens in a particular game with a particular number of cooperators and defectors,
but we need the fitness effects of being a cooperator and defector,
\(f_C\) and \(f_D\), which are averaged over all the games played.</p>
<p>The replicator dynamics assumes that groups are formed randomly from an infinite population,
so the make-up of the other players is binomially distributed.
Therefore, the fitness effect is the sum of the payoffs from each game multiplied by the probability that the player will end up in that game</p>
\[f_C(p) = \sum_{i=0}^{n-1} \underbrace{ {n-1 \choose i} p^i (1-p)^{n-1-i}}_{\text{Pr grouped with $i$ cooperators}} \: b_{i+1} - c,\]
\[f_D(p) = \sum_{i=0}^{n-1} \underbrace{ {n-1 \choose i} p^i (1-p)^{n-1-i}}_{\text{Pr grouped with $i$ cooperators}} \: b_{i}.\]
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">f_c</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">:</span> <span class="nb">sum</span><span class="p">(</span><span class="n">binom</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">l</span><span class="p">)</span> <span class="o">*</span> <span class="n">p</span><span class="o">**</span><span class="n">l</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">p</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="o">-</span><span class="n">l</span><span class="p">)</span> <span class="o">*</span> <span class="n">b</span><span class="p">(</span><span class="n">l</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">n</span><span class="p">))</span> <span class="o">-</span> <span class="n">c</span>
<span class="n">f_d</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">:</span> <span class="nb">sum</span><span class="p">(</span><span class="n">binom</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">l</span><span class="p">)</span> <span class="o">*</span> <span class="n">p</span><span class="o">**</span><span class="n">l</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">p</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="o">-</span><span class="n">l</span><span class="p">)</span> <span class="o">*</span> <span class="n">b</span><span class="p">(</span><span class="n">l</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">n</span><span class="p">))</span></code></pre></figure>
<h3>Pivot probability</h3>
<p>The pivot probability is the probability that a player will end up in a game where \(k-1\) of the other \(n-1\) players is a cooperator</p>
\[\pi_k = {n-1 \choose k-1} p^{k-1} (1-p)^{n-k}.\]
<p>Why is this point significant? If I am in a game and I know that I am the pivotal player,
then it is in my interests to be a cooperator.
If I was a defector and could switch strategies, I would want to switch to cooperate.
We can also intuit that,
if it is likely that I will be the pivotal player,
then it may be in my interests to be a cooperator… we’ll return to this point soon.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">pi_k_fnc</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">:</span> <span class="n">binom</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">k</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="n">p</span><span class="o">**</span><span class="p">(</span><span class="n">k</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">p</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="n">k</span><span class="p">)</span>
<span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">5</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.4</span>
<span class="c1"># y is the number of the other n-1 players who are cooperators
</span><span class="n">yV</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="n">n</span><span class="p">))</span>
<span class="c1"># payoffs
</span><span class="n">pay_C</span> <span class="o">=</span> <span class="p">[</span> <span class="n">b</span><span class="p">(</span><span class="n">y</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="o">-</span> <span class="n">c</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="n">yV</span> <span class="p">]</span>
<span class="n">pay_D</span> <span class="o">=</span> <span class="p">[</span> <span class="n">b</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="n">yV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">yV</span><span class="p">,</span> <span class="n">pay_C</span><span class="p">,</span> <span class="s">'-o'</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'cooperators'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">yV</span><span class="p">,</span> <span class="n">pay_D</span><span class="p">,</span> <span class="s">'-o'</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'red'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'defectors'</span><span class="p">)</span>
<span class="c1"># show the pivot
</span><span class="n">plt</span><span class="p">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">''</span><span class="p">,</span> <span class="n">xy</span><span class="o">=</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">xytext</span><span class="o">=</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">1</span><span class="o">-</span><span class="n">c</span><span class="p">),</span> <span class="n">arrowprops</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">arrowstyle</span><span class="o">=</span><span class="s">'<->'</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'7 player game w. threshold $k=5$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'best'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'no. of cooperators among $n-1$ other players'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">'total payoff'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xticks</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">7</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/show_pivot.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/show_pivot.png" alt="Payoff to cooperators and defectors in the threshold game as a function of the number of cooperators among the other members of the group. If I am the pivotal player, then it is in my interests to cooperate (marked with an arrow)." />
</a>
<figcaption><span>Payoff to cooperators and defectors in the threshold game as a function of the number of cooperators among the other members of the group. If I am the pivotal player, then it is in my interests to cooperate (marked with an arrow).</span></figcaption>
</figure>
<h3>First example of the threshold game</h3>
<p>Let’s just plot an example to start with to get a sense of the dynamics.
Recall</p>
\[\dot{p} = p (1-p) (f_C - f_D)\]
<p>where \(f_C\) and \(f_D\) defined in the paper. Let us plot this.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="c1"># dynamics equation
</span><span class="n">delta_p</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">:</span> <span class="n">p</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">p</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">f_c</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="o">-</span> <span class="n">f_d</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">))</span>
<span class="c1"># some parameter values
</span><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">5</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.3</span>
<span class="c1"># how Delta p changes with p
</span><span class="n">pV</span> <span class="o">=</span> <span class="n">np</span><span class="p">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">60</span><span class="p">)</span>
<span class="n">delta_pV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">delta_p</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">delta_pV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="sa">r</span><span class="s">'$\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="c1"># solve for stable steady state
</span>
<span class="c1"># the p-value at the peak (I'll explain this bit later)
</span><span class="n">p_hat_fnc</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">:</span> <span class="p">(</span><span class="n">k</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
<span class="n">p_hat</span> <span class="o">=</span> <span class="n">p_hat_fnc</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
<span class="n">eql0</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="o">-</span> <span class="n">c</span>
<span class="n">p_s</span> <span class="o">=</span> <span class="n">brentq</span><span class="p">(</span><span class="n">eql0</span><span class="p">,</span> <span class="n">p_hat</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="n">p_s</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="c1"># also plot defector steady state
</span><span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="c1"># show changes with arrows
</span><span class="n">y</span> <span class="o">=</span> <span class="mf">0.01</span>
<span class="n">p_u</span> <span class="o">=</span> <span class="n">brentq</span><span class="p">(</span><span class="n">eql0</span><span class="p">,</span> <span class="n">p_hat</span><span class="p">,</span> <span class="mf">0.1</span><span class="p">)</span> <span class="c1"># solve for unstable steady state
</span><span class="n">plt</span><span class="p">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">''</span><span class="p">,</span> <span class="n">xy</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">xytext</span><span class="o">=</span><span class="p">(</span><span class="n">p_u</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">arrowprops</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">arrowstyle</span><span class="o">=</span><span class="s">'->'</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">''</span><span class="p">,</span> <span class="n">xy</span><span class="o">=</span><span class="p">(</span><span class="n">p_u</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">xytext</span><span class="o">=</span><span class="p">(</span><span class="n">p_s</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">arrowprops</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">arrowstyle</span><span class="o">=</span><span class="s">'<-'</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">''</span><span class="p">,</span> <span class="n">xy</span><span class="o">=</span><span class="p">(</span><span class="n">p_s</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">xytext</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">arrowprops</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">arrowstyle</span><span class="o">=</span><span class="s">'->'</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">))</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'$k=5$, $n=7$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'change in coops $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'lower right'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylim</span><span class="p">((</span><span class="o">-</span><span class="mf">0.06</span><span class="p">,</span> <span class="mf">0.02</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<p>In the figure below,
we find that the all-defector population is an evolutionarily stable steady state,
and the all-cooperation population is unstable.
There is also an evolutionarily stable state with a mix of cooperators and defectors
(at \(p^{\star} = 0.746\)).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/dpdt_v_p.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/dpdt_v_p.png" alt="How the change in the proportion of cooperators varies with the current proportion of cooperators \(p\). There are 2 stable steady states (marked with a solid dot)
and two unstable steady states. The arrows indicate the direction in which the population will evolve given its current \(p\) value." />
</a>
<figcaption><span>How the change in the proportion of cooperators varies with the current proportion of cooperators \(p\). There are 2 stable steady states (marked with a solid dot)
and two unstable steady states. The arrows indicate the direction in which the population will evolve given its current \(p\) value.</span></figcaption>
</figure>
<p>We can also see some of this directly by inspecting the equation for the dynamics.
Recall</p>
\[\frac{dp}{dt} = p (1-p) (f_C(p) - f_D(p)).\]
<p>Steady states occur when \(\frac{dp}{dt} =0\),
so there are two trivial steady states</p>
\[p = 0,\]
<p>and</p>
\[p = 1.\]
<p>and any interior steady states solve</p>
\[0 = f_C(p) - f_D(p).\]
<p>Let’s focus on these interior steady states.
Recall</p>
\[f_C(p) = \sum_{i=0}^{n-1} { n-1 \choose i } p^i (1-p)^{n-1-i} b_{i+1} - c,\]
<p>and</p>
\[f_D(p) = \sum_{i=0}^{n-1} { n-1 \choose i } p^i (1-p)^{n-1-i} b_i,\]
<p>but the \(b_i\) values are only 1 when \(i >=k\), otherwise 0. Therefore,
we can simplify</p>
\[f_C(p) - f_D(p) = \underbrace{ {n-1 \choose k-1} p^{k-1} (1-p)^{n-k}}_{\pi_k(p)} - c,\]
<p>and notice that the pivot probability is in it.</p>
<p>In summary, the dynamics are</p>
\[\frac{dp}{dt} = p \, (1-p) \, \overbrace{ \underbrace{ {n-1 \choose k-1} p^{k-1} (1-p)^{n-k} }_{\pi_k(p)} - c}^{f_C(p) - f_D(p)}\]
<p>Let’s plot just the function that solves the interior steady states</p>
\[\pi_k(p) - c = 0.\]
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="c1"># our \pi_k(p) - c = 0 function to solve
</span><span class="n">Delta_f</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">:</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="o">-</span> <span class="n">c</span>
<span class="c1"># some parameter values
</span><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">5</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.3</span>
<span class="c1"># how the delta f function changes with p
</span><span class="n">Delta_fV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">Delta_f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">Delta_fV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="sa">r</span><span class="s">'$f_C - f_D$'</span><span class="p">)</span>
<span class="c1"># the p-value at the peak (see further below for explanation)
</span><span class="n">p_hat</span> <span class="o">=</span> <span class="n">p_hat_fnc</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
<span class="c1"># solve for stable steady state
</span><span class="n">eql0</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="o">-</span> <span class="n">c</span>
<span class="n">p_s</span> <span class="o">=</span> <span class="n">brentq</span><span class="p">(</span><span class="n">eql0</span><span class="p">,</span> <span class="n">p_hat</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="n">p_s</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'where $\pi_k(p)-c=0$'</span><span class="p">)</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'$k=5$, $n=7$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'$f_C(p) - f_D(p)$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'best'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/fCminusfD_v_p.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/fCminusfD_v_p.png" alt="How the difference in fitness effects changes with the proportion of cooperators. This function also isolates the interior steady states, which solve \( \pi_k(p) - c = 0 \) (stable steady state shown with a solid dot)." />
</a>
<figcaption><span>How the difference in fitness effects changes with the proportion of cooperators. This function also isolates the interior steady states, which solve \( \pi_k(p) - c = 0 \) (stable steady state shown with a solid dot).</span></figcaption>
</figure>
<h3>The peak</h3>
<p>De Jaegher found that,
when \(1 < k < n\), both \(f_C - f_D\) and \(\pi_k\) have a peak at \(\hat{p} = \frac{k-1}{n-1}\).
They found this by taking advantage of the fact that the function is unimodal, and finding when the derivative was 0.</p>
\[f_C(p) - f_D(p) = {n-1 \choose k-1} p^{k-1} (1-p)^{n-k} - c,\]
<p>so</p>
\[\frac{d(f_C(p) - f_D(p))}{dp}
= {n-1 \choose k-1} (1-p)^{n-k-1} p^{k-2} \bigl( (k-1)(1-p) + (k-n) p \bigr).\]
<p>The peak is located where $\frac{d(f_C(p) - f_D(p))}{dp} = 0$
that is</p>
\[0 = (k-1)(1-\hat{p}) + (k-n) \hat{p},\]
<p>which gives the peak location</p>
\[\hat{p} = \frac{k-1}{n-1}.\]
<p>Because \(f_C - f_D\) and \(\pi_k\) differ only by a constant,
this point is also the location of the peak of the pivot probability function.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="c1"># some parameter values
</span><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">5</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.3</span>
<span class="c1"># how the gain function changes with p
</span><span class="n">Delta_fV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">Delta_f</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">Delta_fV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="sa">r</span><span class="s">'$f_C - f_D$'</span><span class="p">)</span>
<span class="c1"># the p-value at the peak
</span><span class="n">p_hat</span> <span class="o">=</span> <span class="n">p_hat_fnc</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axvline</span><span class="p">(</span><span class="n">p_hat</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">,</span> <span class="n">ls</span><span class="o">=</span><span class="s">'dashed'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'peak $\hat{p}$'</span><span class="p">)</span>
<span class="c1"># solve for steady state
</span><span class="n">eql0</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="o">-</span> <span class="n">c</span>
<span class="n">p_s</span> <span class="o">=</span> <span class="n">brentq</span><span class="p">(</span><span class="n">eql0</span><span class="p">,</span> <span class="n">p_hat</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="n">p_s</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'$k=5$, $n=7$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'$f_C(p) - f_D(p)$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'best'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/where_the_peak.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/where_the_peak.png" alt="Example showing the location fo the peak." />
</a>
<figcaption><span>Example showing the location fo the peak.</span></figcaption>
</figure>
<p>Knowing where this peak is and
whether it is above or below the line tells us about the dynamics, as will become clearer in the examples below.</p>
<h3>Examples for Result 1</h3>
<p>Below, we’ll go through examples for each of the cases in Result 1.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="c1"># keep group-size parameter value constant
</span><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="c1"># grid size for plotting
</span><span class="n">pV</span> <span class="o">=</span> <span class="n">np</span><span class="p">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">60</span><span class="p">)</span></code></pre></figure>
<h4>When \(k=1\)</h4>
<p>For the minimal threshold \(k = 1\),
the game has a unique interior fxed point where a fraction \(p_1^{\text{II}} = 1-c^{1/(n-1}\) of players cooperates (Volunteer’s Dilemma).</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">k</span> <span class="o">=</span> <span class="mi">1</span>
<span class="c1"># how Delta p changes with p
</span><span class="n">delta_pV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">delta_p</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">delta_pV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="sa">r</span><span class="s">'$\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="c1"># fixed point
</span><span class="n">p_s</span> <span class="o">=</span> <span class="mi">1</span><span class="o">-</span><span class="n">c</span><span class="o">**</span><span class="p">(</span><span class="mi">1</span><span class="o">/</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="n">p_s</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'$p_1^{II}$'</span><span class="p">)</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'$k=1$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'change in coops $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'best'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/example_volunteers.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/example_volunteers.png" alt="Example dynamics for the Volunteer's Dilemma." />
</a>
<figcaption><span>Example dynamics for the Volunteer's Dilemma.</span></figcaption>
</figure>
<h4>When \(1 < k < n\)</h4>
<p><strong>Low cost</strong></p>
<p>When participation costs are small (\(c < \bar{c}_k\)),
the game both has a fixed point where all players defect (\(p = 0\))
and a stable fixed point \(p_k^{\text{II}}\),
which is implicitly given by \(\pi_k(p_k^{\text{II}}) = c\).</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">k</span> <span class="o">=</span> <span class="mi">5</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.3</span>
<span class="c1"># how Delta p changes with p
</span><span class="n">delta_pV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">delta_p</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">delta_pV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="sa">r</span><span class="s">'$\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="c1"># the p-value at the peak
</span><span class="n">p_hat</span> <span class="o">=</span> <span class="n">p_hat_fnc</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
<span class="c1"># the pivot probability at the p-value at the peak
</span><span class="n">c_bar</span> <span class="o">=</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p_hat</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
<span class="c1"># solve for steady state
</span><span class="n">eql0</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="o">-</span> <span class="n">c</span>
<span class="n">p_s</span> <span class="o">=</span> <span class="n">brentq</span><span class="p">(</span><span class="n">eql0</span><span class="p">,</span> <span class="n">p_hat</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="n">p_s</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'$p_k^{II}$'</span><span class="p">)</span>
<span class="c1"># also plot defector ss
</span><span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'$k=5$, '</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">c</span><span class="p">)</span> <span class="o">+</span> <span class="s">' = $c < c_k$ = '</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="mi">1000</span><span class="o">*</span><span class="n">c_bar</span><span class="p">)</span><span class="o">/</span><span class="mi">1000</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'change in coops $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'best'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/example_hybrid.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/example_hybrid.png" alt="Example dynamics for the Hybrid Game." />
</a>
<figcaption><span>Example dynamics for the Hybrid Game.</span></figcaption>
</figure>
<p><strong>High cost</strong></p>
<p>When participation costs are high, \(c > \bar{c}_k\),
the game has a unique stable fixed point where all players defect (\(p = 0\)).</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">c</span> <span class="o">=</span> <span class="mf">0.35</span>
<span class="c1"># how Delta p changes with p
</span><span class="n">delta_pV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">delta_p</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">delta_pV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="sa">r</span><span class="s">'$\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="c1"># the p-value at the peak
</span><span class="n">p_hat</span> <span class="o">=</span> <span class="n">p_hat_fnc</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
<span class="c1"># plot defector ss
</span><span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'$k=5$, '</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">c</span><span class="p">)</span> <span class="o">+</span> <span class="s">' = $c > c_k$ = '</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="mi">1000</span><span class="o">*</span><span class="n">c_bar</span><span class="p">)</span><span class="o">/</span><span class="mi">1000</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'change in coops $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'best'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/example_PD.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/example_PD.png" alt="Example dynamics for the situation they liken to the Prisoner's Dilemma." />
</a>
<figcaption><span>Example dynamics for the situation they liken to the Prisoner's Dilemma.</span></figcaption>
</figure>
<p>What’s the significance of this \(\bar{c}_k\) value?
Recall</p>
\[f_C(p) - f_D(p) = \underbrace{ {n-1 \choose k-1} p^{k-1} (1-p)^{n-k}}_{\pi_k(p)} - c.\]
<p>They’ve defined</p>
\[\bar{c}_k = \pi_k(\hat{p}),\]
<p>where \(\hat{p}\) is the probability at the peak.
So we know that, if \(\bar{c}_k > c\),
the \(f_C - f_D\) line will be above the zero line at the peak and there will be an interior equilibrium,
and if \(\bar{c}_k < c\),
the peak is below the line and there are no interior equilibria.</p>
<h4>When \(k = n\)</h4>
<p>Our final case is the maximum threshold,
\(k=n\).
Here,
the game both has a stable steady state where all players defect (\(p = 0\)),
and a stable steady state where all players cooperate (\(p = 1\)).
The basin of attraction is defined by \(p_n^{\text{I}} = c^{1/(n-1)}\),
the unstable interior steady state.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">k</span> <span class="o">=</span> <span class="n">n</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.3</span>
<span class="c1"># how Delta p changes with p
</span><span class="n">delta_pV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">delta_p</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">delta_pV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="sa">r</span><span class="s">'$\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="c1"># the pivot probability at the p-value at the peak
</span><span class="n">pi_k</span> <span class="o">=</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p_hat</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
<span class="c1"># separatrix
</span>
<span class="c1"># trivial equilibria are steady states
</span><span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'$k=n$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'change in coops $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'best'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/example_staghunt.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/example_staghunt.png" alt="Example dynamics for the situation they liken to a Stag Hunt." />
</a>
<figcaption><span>Example dynamics for the situation they liken to a Stag Hunt.</span></figcaption>
</figure>
<h4>Bringing it all together</h4>
<p>We can place each of these examples on De Jaegher’s Fig. 4.
The 4 regions of the figure represent four different qualitative regimes for the dynamics (game types).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/DeJaegher_Fig4_spaceout.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/DeJaegher_Fig4_spaceout.png" alt="Placing each of our examples onto De Jaegher's Fig. 4. The four regions reprsent four qualitatively different regimes for the dynamics." />
</a>
<figcaption><span>Placing each of our examples onto De Jaegher's Fig. 4. The four regions reprsent four qualitatively different regimes for the dynamics.</span></figcaption>
</figure>
<h3>Examples for Result 2</h3>
<p>De Jaegher found that the threshold level has a U-shaped efect on the level of cooperation,
which can be seen in their Fig. 4 (the shape of the division between the blue and green region).
Let’s plot how the dynamics varies with varying threshold level.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.33</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">):</span>
<span class="c1"># how Delta p changes with p
</span> <span class="n">delta_pV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">delta_p</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">delta_pV</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">k</span><span class="p">))</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="sa">r</span><span class="s">'the full $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'change in coops $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'upper center'</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">'$k=$'</span><span class="p">,</span> <span class="n">ncol</span> <span class="o">=</span> <span class="mi">7</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s">'x-small'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylim</span><span class="p">((</span><span class="o">-</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.06</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<p>Here,
we see that cooperation can evolve both for low and for high thresholds, but not for intermediate thresholds.
It is perhaps surprising because, intuitively, it seems like a high threshold would be more difficult to obtain.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/threshold_dpdt.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/threshold_dpdt.png" alt="The effect of different threshold levels on the dynamics. In this example, cooperation can evolve if the threshold is low or high, but not for intermediate values." />
</a>
<figcaption><span>The effect of different threshold levels on the dynamics. In this example, cooperation can evolve if the threshold is low or high, but not for intermediate values.</span></figcaption>
</figure>
<p>This U-shape emerges from the pivot probabilities.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.33</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">):</span>
<span class="c1"># how Delta p changes with p
</span> <span class="n">pi_kV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">pi_kV</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">k</span><span class="p">))</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'just the $\pi_k$ bit'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">'$\pi_k(p)$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'upper center'</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">'$k=$'</span><span class="p">,</span> <span class="n">ncol</span> <span class="o">=</span> <span class="mi">7</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s">'xx-small'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/threshold_pivot.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/threshold_pivot.png" alt="Different threshold levels have a U-shaped effect on the pivot probability." />
</a>
<figcaption><span>Different threshold levels have a U-shaped effect on the pivot probability.</span></figcaption>
</figure>
<h3>Group size</h3>
<p>De Jaegher discuss the possibility of stabilising a game by changing the group size.
If cooperation is more likely to persist at low or high thresholds,
then perhaps increasing or decreasing the group size to shift the relative position of the threshold could stabilise cooperation.</p>
<p>It turns out this is true for decreasing the group size, but not for increasing it.
Increasing the group size has a negative effect on cooperation.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.33</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">4</span>
<span class="c1"># plot the previous
</span><span class="n">delta_pV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">delta_p</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">delta_pV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">,</span> <span class="n">ls</span><span class="o">=</span><span class="s">'dashed'</span><span class="p">)</span>
<span class="c1"># plot for a range
</span><span class="n">nV</span> <span class="o">=</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">12</span><span class="p">]</span>
<span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">nV</span><span class="p">:</span>
<span class="c1"># how Delta p changes with p
</span> <span class="n">delta_pV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">delta_p</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">delta_pV</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">n</span><span class="p">))</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="sa">r</span><span class="s">'the full $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s">'change in coops $\frac{dp}{dt}$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'upper center'</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">'$n=$'</span><span class="p">,</span> <span class="n">ncol</span> <span class="o">=</span> <span class="mi">7</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s">'x-small'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylim</span><span class="p">((</span><span class="o">-</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.06</span><span class="p">))</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/dpdt_vary_n.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/dpdt_vary_n.png" alt="In this example, we have kept the threshold level \(k=4\) constant, but varied the group size. Decreasing the group size allows the interior steady state, with coexistence of cooperators and defectors, to emerge; but increasing the group size has a negative effect on cooperation." />
</a>
<figcaption><span>In this example, we have kept the threshold level \(k=4\) constant, but varied the group size. Decreasing the group size allows the interior steady state, with coexistence of cooperators and defectors, to emerge; but increasing the group size has a negative effect on cooperation.</span></figcaption>
</figure>
<p>The reason why is due to the effect of group size on the pivot probability: the larger the group is, the less likely it is for a player to be the pivotal player, and so the lower the benefit of being a cooperator.</p>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">n</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.33</span>
<span class="n">k</span> <span class="o">=</span> <span class="mi">4</span>
<span class="c1"># plot the previous
</span><span class="n">pi_kV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">pi_kV</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">,</span> <span class="n">ls</span><span class="o">=</span><span class="s">'dashed'</span><span class="p">)</span>
<span class="c1"># plot for a range
</span><span class="n">nV</span> <span class="o">=</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">12</span><span class="p">]</span>
<span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">nV</span><span class="p">:</span>
<span class="c1"># how pivot probability changes with p
</span> <span class="n">pi_kV</span> <span class="o">=</span> <span class="p">[</span> <span class="n">pi_k_fnc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pV</span> <span class="p">]</span>
<span class="n">plt</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pV</span><span class="p">,</span> <span class="n">pi_kV</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">n</span><span class="p">))</span>
<span class="c1"># decorate plot
</span><span class="n">plt</span><span class="p">.</span><span class="n">title</span><span class="p">(</span><span class="s">'just the $\pi_k$ bit'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">axhline</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'black'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">'propn cooperators $p$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">'$\pi_k(p)$'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">'upper center'</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">'$n=$'</span><span class="p">,</span> <span class="n">ncol</span> <span class="o">=</span> <span class="mi">7</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="s">'xx-small'</span><span class="p">)</span>
<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/08/pivot_vary_n.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/08/pivot_vary_n.png" alt="The larger the group size is, the less likely it is that a player is the pivotal player." />
</a>
<figcaption><span>The larger the group size is, the less likely it is that a player is the pivotal player.</span></figcaption>
</figure>
<h3>References</h3>
<p>De Jaegher, K. (2020). <a href="https://www.nature.com/articles/s41598-020-62626-3">High thresholds encouraging the evolution of cooperation in threshold public-good games</a>. <em>Scientific Reports</em>, <strong>10</strong>(1), 1-10.</p>nadiahkristensenLast month, I chose a paper by Kris De Jaegher in Scientific Reports for our weekly lab-meeting discussion. We used the paper to teach ourselves about threshold games, and the purpose of this blog post is to summarise the things we learnt.Predator dilution effect synchronises fish migration2022-07-01T04:44:54+00:002022-07-01T04:44:54+00:00https://nadiah.org/2022/07/01/fish-synchrony<p>I recently came across <a href="https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/1365-2656.13790">a paper by Kaj Hulthen and others in <em>Journal of Animal Ecology</em></a>
showing good empirical evidence for <a href="https://nadiah.org/wp-content/uploads/2019/03/Harts_et_al-2016-Oikos.pdf">a model</a> I coauthored a few years ago with Anna Harts and <a href="https://www.kokkonuts.org/">Hanna Kokko</a>.
Hulthen <em>et al.</em> (2022) were interested in the migration timing of roach (<em>Rutilus rutilus</em>).
Specifically, they were interested in how the combination of selection for early arrival plus high predation risk could explain the relatively high migration synchrony in spring compared to autumn.</p>
<p>Roach migrate from lake to stream in autumn,
and from stream to lake in spring.
In the lake in spring, zooplankton numbers peak,
and arriving too late may mean missing out on foraging and also mating opportunities.
However,
lake pike and piscivorous birds present a high predation risk.
Individuals can reduce their predation risk by arriving later than the others, when there already many other roach in the lake. This provides ‘safety in numbers’, also known as the predator dilution effect.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/07/Rutilus_rutilus_Prague_Vltava_3.jpg">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/07/Rutilus_rutilus_Prague_Vltava_3.jpg" alt="A roach. By Karelj - Own work, Public Domain, https://commons.wikimedia.org/w/index.php?curid=14954932 https://commons.wikimedia.org/wiki/User:Karelj." />
</a>
<figcaption><span>A roach. By Karelj - Own work, Public Domain, https://commons.wikimedia.org/w/index.php?curid=14954932 https://commons.wikimedia.org/wiki/User:Karelj.</span></figcaption>
</figure>
<p>According to our model (Harts <em>et al.</em> 2016),
the net effect of selection for both early and late arrival (relative to conspecifics) is that selection will favour synchronous arrival–
and this is also what Hulthen <em>et al.</em> found.</p>
<p>Hulthen <em>et al.</em> gathered highly detailed individual-based tracking data.
They surveyed two different lake-and-stream systems,
lake Krankesjön and lake Søgård,
over 7 and 9 years, tracking 4093 and 1909 individuals, respectively.
They used return migration as a proxy for survival,
and measured synchrony in arrival time using Cagnacci <em>et al.</em> (2011, 2016)’s circular variable \(\rho\).</p>
<p>The circular variable is a rather neat way of summarising how synchronous timings are.
The days of the year are evenly spaced along the perimeter of a circle with radius 1,
and each arrival is encoded as a vector from the origin to the day.
Synchrony is then measured as the length of the vector that results from taking the average of all the arrival vectors.
The length varies from \(\rho = 0\) to 1, where low values indicate low synchrony and high values indicate high synchrony.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/07/circular_variable.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/07/circular_variable.png" alt="An example calculating the synchrony between two dates for (a) highly synchronous (b) less synchronous dates. The length of the average vector (blue) is the circular variable \( \rho \).
The more synchronous the dates are, the longer the average vector is." />
</a>
<figcaption><span>An example calculating the synchrony between two dates for (a) highly synchronous (b) less synchronous dates. The length of the average vector (blue) is the circular variable \( \rho \).
The more synchronous the dates are, the longer the average vector is.</span></figcaption>
</figure>
<p>Hulthen <em>et al.</em> (2022)’s findings were that migration during spring, from streams to lakes, was more synchronous than migration during autumn.
They also found that there was a survival cost associated with early migration in the spring but not the autumn,
consistent with a predator dilution effect.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/07/Hulthen22_Fig2.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/07/Hulthen22_Fig2.png" alt="Comparing the relative migration timing of individuals who survived and did not survive to the next year. Non-survivors migrated earlier in the spring, but not in the autumn, consistent with a predator dilution effect that selects against arriving early relative to the bulk of the population in spring. Adapted from their Fig. 2." />
</a>
<figcaption><span>Comparing the relative migration timing of individuals who survived and did not survive to the next year. Non-survivors migrated earlier in the spring, but not in the autumn, consistent with a predator dilution effect that selects against arriving early relative to the bulk of the population in spring. Adapted from their Fig. 2.</span></figcaption>
</figure>
<p>I was curious to see the synchrony result visually,
so I downloaded their data and plotted the synchrony in each lake in each year for spring and autumn
(Python script <a href="https://github.com/nadiahpk/hulthen-2022-playground">here</a>).
The effect is strong enough that it can be seen just by looking at this plot.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/07/my_plot.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/07/my_plot.png" alt="The synchrony (\(\rho\)) for each year for each lake in spring (red) versus autumn (blue). Synchrony is higher in spring than autumn." />
</a>
<figcaption><span>The synchrony (\(\rho\)) for each year for each lake in spring (red) versus autumn (blue). Synchrony is higher in spring than autumn.</span></figcaption>
</figure>
<p>It’s really interesting to me to see these results for fish.
As Hulthen <em>et al.</em> note, a lot of the work on migratory timing is for birds,
and certainly I had bird examples in mind when working on the model simply because that is my background.
But evidently the concepts of early arrival and predator dilution are general and apply to many taxonomic groups.</p>
<p>Another recent <a href="https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/1365-2656.13308">study by Pärssinen <em>et al.</em> (2020)</a>
also found evidence of the predator dilution effect in fish.
Hybrids of roach and bream had intermediate migration time that left them vulnerable to predation by cormorants.
The special thing about predator dilution is that, all else being equal, the particular timing that evolves is evolutionarily stable but not convergent stable. Essentially this means that the timing that evolves is arbitrary,
contingent on initial conditions or chance clustering.
This implies there could be a great many timings that initiate or maintain divergence provided they are far enough apart and a large enough population maintains each timing.</p>
<h3>References</h3>
<p>Cagnacci, F., Focardi, S., Ghisla, A., van Moorter, B., Merrill, E. H., Gurarie, E., Heurich, M., Mysterud, A., Linnell, J., Panzacchi, M., May, R., Nygard, T., Rolandsen, C., & Hebblewhite, M. (2016). How many routes lead to migration? Comparison of methods to assess and characterize migratory movements. Journal of Animal Ecology, 85, 54–68.</p>
<p>Cagnacci, F., Focardi, S., Heurich, M., Stache, A., Hewison, A. J. M., Morellet, N., Kjellander, P., Linnell, J. D. C., Mysterud, A., Neteler, M., Delucchi, L., Ossi, F., & Urbano, F. (2011). Partial migration in roe deer: Migratory and resident tactics are end points of a behavioural gradient determined by ecological factors. Oikos, 120, 1790–1802.</p>
<p>Harts, A. M. F., Kristensen, N. P., & Kokko, H. (2016). <a href="https://nadiah.org/wp-content/uploads/2019/03/Harts_et_al-2016-Oikos.pdf">Predation can select for later and more synchronous arrival times in migrating species</a>. Oikos, 125, 1528–1538.</p>
<p>Hulthén, K., Chapman, B. B., Nilsson, P. A., Hansson, L. A., Skov, C., Brodersen, J., & Brönmark, C. (2022). <a href="https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/1365-2656.13790">Timing and synchrony of migration in a freshwater fish: Consequences for survival</a>. Journal of Animal Ecology, In Press</p>
<p>Pärssinen, V., Hulthén, K., Brönmark, C., Skov, C., Brodersen, J., Baktoft, H., Chapman, B. B., Hansson, L-A. & Nilsson, P. A. (2020). <a href="https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/1365-2656.13308">Maladaptive migration behaviour in hybrids links to predator‐mediated ecological selection</a>. Journal of Animal Ecology, 89(11), 2596–2604.</p>nadiahkristensenI recently came across a paper by Kaj Hulthen and others in Journal of Animal Ecology showing good empirical evidence for a model I coauthored a few years ago with Anna Harts and Hanna Kokko. Hulthen et al. (2022) were interested in the migration timing of roach (Rutilus rutilus). Specifically, they were interested in how the combination of selection for early arrival plus high predation risk could explain the relatively high migration synchrony in spring compared to autumn.Human cooperation and social network expansion over time2022-04-01T04:44:54+00:002022-04-01T04:44:54+00:00https://nadiah.org/2022/04/01/declining-homophily<p>It is generally held that human cooperation first evolved in our ancestral past,
when we tended to live in small groups composed mostly of family members,
and when cooperation could therefore be selected for by kin selection.
This narrative is also sometimes invoked to explain the origin of cooperative mechanisms that are primarily about
cooperation between nonkin.
For example,
in the iterated Prisoner’s Dilemma,
cooperation between nonkin can be maintained by the tit-for-tat strategy,
and a population of tit-for-tat players can resist invasion by defectors.
However, tit-for-tat strategists cannot invade a population of defectors (presumably the primordial strategy),
and so the question remains how it got started in the first place.
Axelrod & Hamilton (1981) proposed that one way could have been if
dispersal was low enough in the past that cooperative types tended to cluster together.</p>
<p>Over the course of the human lineage,
there is a general pattern expanding social networks and declining relatedness between interacting individuals.
DNA analysis back to 45 ka shows a general decline in background relatedness over time,
with a marked change at the Neolithic Demographic Transition (Ringbauer et al., 2021),
when the advent of farming in each region coincided with a sudden increase in population size (Bocquet-Appel, 2011).
In industrialised societies,
falling mortality and fertility has also reduced the size of kin networks (David-Barrett, 2019),
motivating new bases for social identity (David-Barrett, 2020).
In the popular imagination,
the lifeways of hunter-gatherer people represent our closest analogue to what the deep ancestral past must have been like;
however, modern hunter-gatherers also maintain expansive social networks with hundreds of unrelated individuals
(Hill et al., 2011; Bird et al., 2019),
and groups congregate seasonally for communal hunting and socialising (Kelly, 2013; Balme, 2018).</p>
<p>Not a lot is known about social structure before 45 ka (Graeber and Wengrow, 2018),
and so inferences must be made on the basis of fossils and other material evidence.
One potential indicator of social structure is the distance that materials were transported from their source.
Before around 1.6 Ma, raw-material transport distances are comparable to chimpanzee home-range sizes (∼ 13 km),
indicating relatively isolated social groups composed mostly of kin (Marwick, 2003).
Distances and occurrences of material transport subsequently increased over the course of the Early and Middle Stone Age.
For example,
approximately 295-320 ka, obsidian and ochre were transported 25-50 km (as the crow flies) (Brooks et al., 2018).
After ~130 ka, raw-material transport distances frequently exceeded 300 km (Marwick, 2003).
These distances may be indicative of networks of exchange,
which implies increased language abilities (Marwick, 2003) and notions of relatedness beyond genetic kin (Moutsiou, 2012).
However, we must also be cautious when trying to infer what these exchanges meant,
because humans are quirky and sometimes transport materials over long distances for unexpected reasons (Graeber and Wengrow, 2018).</p>
<p>The types of materials that are found can also be indicative of something social.
Tool sophistication and symbolic development may be indicative of cognitive and social development,
and their stylistic diversity indicative of cultures and the flow of information between them.
In the early period (~1.5-0.4 Ma),
evidence of material innovation is scarce;
but nonetheless,
encephalisation increased over this period,
which some authors attribute to the demands of increasing social complexity (Gamble et al., 2011).
The transport of ochre mentioned above, from 295-320 ka,
is notable because ochre is used by modern people as a pigment, either for artwork or body ornamentation,
and as a potential indicator of one’s group identity (Brooks et al., 2018).</p>
<p>The appearance of beads (> 142 ka Sehasseh et al., 2021) may be important because they can be used
to communicate social identity (e.g., group membership and marital status) to strangers.
The use of beads greatly increased around the same time that population sizes increased (40-45 ka, Kuhn et al., 2001),
which further supports the idea that beads were used in this way.
Beads were also transported long distances;
for example, shell beads found in the Kimberly, Australia, from 30 ka,
were transported > 300 km from their source (Balme and Morse, 2006).
It is interesting to note that some modern hunter-gatherers use the exchange of beads
as the substrate for indoctrinating children into socially defined notions of kinship (Wiessner, 1998).
We also find long-distance transport of other materials potentially used to communicate identity,
e.g., ochre from 32 ka transported 125 km in central Australia (Smith et al., 1998).</p>
<p>An expanding social network could have provided the opportunity to experiment with different styles of
large-scale collective action (Graeber and Wengrow, 2021).
For example,
the use of nets is an indicator of communal hunting,
particularly of the integration of labour from women, children, and the elderly (Soffer et al., 2001).
Evidence of large-scale fishing operations occur from 27 ka in Australia (Balme, 1995).</p>
<p>Acquiring meat may have been one of our ancestors’ first collaborative activities,
and collaborative foraging in general has been linked to the early stages of human cooperation
(Tomasello et al. 2012).
Unfortunately, it is unclear exactly how animal products were first acquired by our ancestors:
were they working together to take down large prey in some way (Domínguez-Rodrigo et al., 2021),
or were they opportunistically finding and/or snatching scraps from animals taken down by other carnivores
(Pobiner, 2020)?
Perhaps scavenging itself was a collaborative activity if that meant confronting and scaring away
large, dangerous carnivores who were still at their meals (Bickerton & Szathmáry, 2011)?</p>
<p>In the figure below,
I’ve sketched out a rough timeline of some of the elements above.
This should help orient different narratives about how cooperation evolved.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/04/key_dates_image.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/04/key_dates_image.png" alt="Figure 1: A rough timeline of transport distances, social care, and hunting over the course of the human lineage. Sources: [1] Thompson et al. (2019); [2] Cunha (2016); [3] Domínguez-Rodrigo et al. (2005); [4] Domínguez-Rodrigo et al. (2021); [5] Bramble (2004); [6] Pobiner (2020); [7] Bickerton & Szathmáry (2011); [8] Wilkins et al. (2012); [9] Oakley et al. (1977); [10] Allington-Jones (2015); [11] Lombard (2016); [12] Balme (2018); [13] Marwick (2003); [14] Balme and Morse (2006); [15] Smith et al. (1998); [16] Brooks et al. (2018); [17] Balme et al. (2009); [18] Sehasseh et al. (2021); [19] Gamble et al. (2011); [20] Kuhn et al. (2001)." />
</a>
<figcaption><span>Figure 1: A rough timeline of transport distances, social care, and hunting over the course of the human lineage. Sources: [1] Thompson et al. (2019); [2] Cunha (2016); [3] Domínguez-Rodrigo et al. (2005); [4] Domínguez-Rodrigo et al. (2021); [5] Bramble (2004); [6] Pobiner (2020); [7] Bickerton & Szathmáry (2011); [8] Wilkins et al. (2012); [9] Oakley et al. (1977); [10] Allington-Jones (2015); [11] Lombard (2016); [12] Balme (2018); [13] Marwick (2003); [14] Balme and Morse (2006); [15] Smith et al. (1998); [16] Brooks et al. (2018); [17] Balme et al. (2009); [18] Sehasseh et al. (2021); [19] Gamble et al. (2011); [20] Kuhn et al. (2001).</span></figcaption>
</figure>
<h3>References</h3>
<p>Allington-Jones, L. (2015). The Clacton spear: The last one hundred years. Archaeological Journal, 172(2), 273-296.</p>
<p>Axelrod, R., & Hamilton, W. D. (1981). The evolution of cooperation. Science, 211(4489), 1390-1396.</p>
<p>Balme, J., Davidson, I., McDonald, J., Stern, N., & Veth, P. (2009). Symbolic behaviour and the peopling of the southern arc route to Australia. Quaternary International, 202(1-2), 59-68.</p>
<p>Balme, J. (1995). 30,000 years of fishery in western New South Wales, Archaeology in Oceania 30(1): 1–21.</p>
<p>Balme, J. (2018). Communal hunting by aboriginal australians: archaeological and ethnographic evidence, in K. Carlson and L. Bemet (eds), Manipulating Prey: Development of Large-Scale Kill Events Around the Globe, University of Colorado Press, Boulder, Colorado, pp. 42–62.</p>
<p>Balme, J. and Morse, K. (2006). Shell beads and social behaviour in Pleistocene Australia, antiquity 80(310): 799–811.</p>
<p>Bickerton, D., & Szathmáry, E. (2011). Confrontational scavenging as a possible source for language and cooperation. BMC Evolutionary Biology, 11(1), 1-7.</p>
<p>Bird, D. W., Bird, R. B., Codding, B. F. and Zeanah, D. W. (2019). Variability in the organization and size of hunter-gatherer groups: Foragers do not live in small-scale societies, Journal of human evolution 131: 96–108.</p>
<p>Bocquet-Appel, J.-P. (2011). When the world’s population took off: the springboard of the Neolithic Demographic Transition, Science 333(6042): 560–561.</p>
<p>Bramble, D. M., & Lieberman, D. E. (2004). Endurance running and the evolution of Homo. nature, 432(7015), 345-352.</p>
<p>Brooks, A. S., Yellen, J. E., Potts, R., Behrensmeyer, A. K., Deino, A. L., Leslie, D. E., Ambrose, S. H., Ferguson, J. R., d’Errico, F., Zipkin, A. M., Whittaker, S., Post, J., Veatch, E. G., Foecke, K. and Clark, J. B. (2018). Long-distance stone transport and pigment use in the earliest Middle Stone Age, Science 360(6384): 90–94.</p>
<p>Cunha, E. (2016). Compassion between humans since when? What the fossils tell us. Etnográfica. Revista do Centro em Rede de Investigação em Antropologia, 20(3)), 653-657.</p>
<p>David-Barrett, T. (2019). Network effects of demographic transition, Scientific Reports 9(1): 1–10.</p>
<p>David-Barrett, T. (2020). Herding friends in similarity-based architecture of social networks, Scientific Reports 10(1): 1–6.</p>
<p>Domínguez-Rodrigo, M., Pickering, T. R., Semaw, S., & Rogers, M. J. (2005). Cutmarked bones from Pliocene archaeological sites at Gona, Afar, Ethiopia: implications for the function of the world’s oldest stone tools. Journal of Human Evolution, 48(2), 109-121.</p>
<p>Domínguez-Rodrigo, M., Baquedano, E., Organista, E., Cobo-Sánchez, L., Mabulla, A.,
Maskara, V., Gidna, A., Pizarro-Monzo, M., Aramendi, J. et al. (2021) Early Pleistocene
faunivorous hominins were not kleptoparasitic, and this impacted the evolution of human
anatomy and socio-ecology. Scientific Reports, 11(1), 1–13.</p>
<p>Gamble, C., Gowlett, J. and Dunbar, R. (2011). The social brain and the shape of the Palaeolithic, Cambridge Archaeological Journal 21(1): 115–136.</p>
<p>Graeber, D., & Wengrow, D. (2018). How to change the course of human history. Eurozine. Retrieved from https://www. eurozine. com/change-course-human-history.</p>
<p>Graeber, D. and Wengrow, D. (2021). The dawn of everything: A new history of humanity, Farrer, Straus and Giroux, New York.</p>
<p>Hill, K. R., Walker, R. S., Božičević, M., Eder, J., Headland, T., Hewlett, B., Hurtado, A. M., Marlowe, F., Wiessner, P. and Wood, B. (2011). Co-residence patterns in hunter-gatherer societies show unique human social structure, Science 331(6022): 1286–1289.</p>
<p>Kelly, R. L. (2013). The Lifeways of Hunter-Gatherers: The Foraging Spectrum, Cambridge University Press, Cambridge.</p>
<p>Kuhn, S. L., Stiner, M. C., Reese, D. S. and Güleç, E. (2001). Ornaments of the earliest Upper Paleolithic: New insights from the Levant, Proceedings of the National Academy of Sciences 98(13): 7641–7646.</p>
<p>Lombard, M. (2016). Mountaineering or ratcheting? Stone Age hunting weapons as proxy for the evolution of human technological, behavioral and cognitive flexibility. In The nature of culture (pp. 135-146). Springer, Dordrecht.</p>
<p>Marwick, B. (2003). Pleistocene exchange networks as evidence for the evolution of language, Cambridge Archaeological Journal 13(1): 67–81.</p>
<p>Moutsiou, T. (2012). Changing scales of obsidian movement and social networking, Unravelling the Palaeolithic: Ten years of research at the Centre for the Archaeology of Human Origins (CAHO, University of Southampton), British Archaeological Reports, pp. 85–95.</p>
<p>Oakley, K. P., Andrews, P., Keeley, L. H., & Clark, J. D. (1977). A reappraisal of the Clacton spearpoint. In Proceedings of the Prehistoric Society (Vol. 43, pp. 13-30). Cambridge University Press.</p>
<p>Pobiner, B. L. (2020). The zooarchaeology and paleoecology of early hominin scavenging. Evolutionary Anthropology: Issues, News, and Reviews, 29(2), 68-82.</p>
<p>Ringbauer, H., Novembre, J. and Steinrücken, M. (2021). Parental relatedness through time revealed by runs of homozygosity in ancient dna, Nature Communications 12(1): 1–11.</p>
<p>Soffer, O., Adovasio, J. M., & Hyland, D. C. (2001). Perishable technologies and invisible people: nets, baskets, and “Venus” wear ca. 26,000 BP. Enduring Records: the Environmental and Cultural Heritage, 233-45.</p>
<p>Thompson, J. C., Carvalho, S., Marean, C. W., & Alemseged, Z. (2019). Origins of the human predatory pattern: The transition to large-animal exploitation by early hominins. Current Anthropology, 60(1), 1-23.</p>
<p>Tomasello, M., Melis, A. P., Tennie, C., Wyman, E. & Herrmann, E. (2012) Two key steps in the evolution of human cooperation: The interdependence hypothesis. Current Anthropology, 53(6), 673–692.</p>
<p>Sehasseh, E. M., Fernandez, P., Kuhn, S., Stiner, M., Mentzer, S., Colarossi, D., Clark, A., Lanoe, F., Pailes, M., Hoffmann, D. et al. (2021). Early Middle Stone Age personal ornaments from Bizmoune Cave, Essaouira, Morocco, Science Advances 7(39): eabi8620.</p>
<p>Smith, M., Fankhauser, B. and Jercher, M. (1998). The changing provenance of red ochre at puritjarra rock shelter, central australia: Late pleistocene to present, 64: 275–292.</p>
<p>Wiessner, P. (1998). Indoctrinability and the evolution of socially defined kinship, in I. Eibl-Eibesfeldt and F. Salter (eds), Indoctrinability, ideology and warfare: evolutionary perspectives, Berghahn Books, Oxford, pp. 133–150.</p>
<p>Wilkins, J., Schoville, B. J., Brown, K. S., & Chazan, M. (2012). Evidence for early hafted hunting technology. Science, 338(6109), 942-946.</p>nadiahkristensenIt is generally held that human cooperation first evolved in our ancestral past, when we tended to live in small groups composed mostly of family members, and when cooperation could therefore be selected for by kin selection. This narrative is also sometimes invoked to explain the origin of cooperative mechanisms that are primarily about cooperation between nonkin. For example, in the iterated Prisoner’s Dilemma, cooperation between nonkin can be maintained by the tit-for-tat strategy, and a population of tit-for-tat players can resist invasion by defectors. However, tit-for-tat strategists cannot invade a population of defectors (presumably the primordial strategy), and so the question remains how it got started in the first place. Axelrod & Hamilton (1981) proposed that one way could have been if dispersal was low enough in the past that cooperative types tended to cluster together.Stochastic evolutionary dynamics of the Volunteers’ Dilemma2022-03-01T04:44:54+00:002022-03-01T04:44:54+00:00https://nadiah.org/2022/03/01/tutic-model<p>The purpose of this blog post is to use a recent paper by Tutić (2021) to teach myself about stochastic
evolutionary game theory.</p>
<p>Tutić’s (2021) model concerns the Volunteer’s Dilemma, which is a public goods game where the public
good is provided if at least one group member cooperates. In the replicator dynamics, cooperators
can always invade a population of defectors. However, as the group size increases, the proportion
of cooperators in the population at the evolutionary steady-state declines (see Tutić (2021) Fig. 6),
which increases the risk that cooperators will be lost from a finite population where stochastic forces are strong.</p>
<p>The game payoffs to defectors are 0 if no other group members are cooperators (no public good produced),
and \(\beta\) if there is at least one.
The payoff to cooperators is always \(\beta - \gamma\), where \(\gamma\) is the cost of providing the public good.
Tutić (2021) used the default values of \(\beta = 4\) and \(\gamma = 2\).</p>
<p>The contribution of the game to fitness is governed by selection strength \(w\),
so the fitness of cooperators and defectors is</p>
\[\begin{align}
\pi^w_c(i, h) &= 1 - w + w \pi_c(i, h), \\
\pi^w_d(i, h) &= 1 - w + w \pi_d(i, h),
\end{align}\]
<p>where \(\pi_x(i, h)\) are the expected payoffs in a population (size \(n\)) with \(i\) cooperators from games with \(h\) players.
They are,</p>
\[\begin{align}
\pi_c(i, h) &= \beta - \gamma, \\
\pi_d(i, h) &= \beta \left( 1 - \frac{ {n-i-1 \choose h-1} }{ {n-1 \choose h-1} } \right).
\end{align}\]
<p>The combinatorial term is the probability that all other members of the defector’s group are defectors,
which has a hypergeometric distribution.</p>
<p>The dynamics are modelled as a Moran process,
and we’re interested in the transitions in the number of cooperators \(i\).
The probability of a transition from \(i\) cooperators to \(i+1\) is</p>
\[\begin{equation}
p_{i, i+1} = \left( \frac{n-i}{n} \right) \left( \frac{\pi^w_c(i,h) i}{\pi^w_c(i,h) i + \pi^w_d(i,h)(n-i)} \right),
\end{equation}\]
<p>where the first bracketed term is the probability that a defector dies,
and the second term is the probability that they are replaced by a cooperator,
which depends on the average fitness of cooperators above.
By similar reasoning,</p>
\[\begin{equation}
p_{i, i-1} = \left( \frac{i}{n} \right) \left( \frac{\pi^w_d(i,h) i}{\pi^w_c(i,h) i + \pi^w_d(i,h)(n-i)} \right),
\end{equation}\]
<p>and \(p_{i, i} = 1 - p_{i, i+1} - p_{i, i-1}\).</p>
<p>Tutić (2021) used the method of Nowak (2006) to find the cooperator fixation probabilities.
There seems to be a typo in the second equation on page 7 (the `\(\ldots\)’);
according to page 99 of Nowak (2006),
the fixation probability given initial \(i\) should read</p>
\[\begin{equation}
x_i = x_1 \left( 1 + \sum_{j=1}^{i-1} \prod_{k=1}^j \frac{\pi_d^w(k,h)}{\pi_c^w(k,h)} \right).
\end{equation}\]
<p>To find cooperator fixation probabilities,
I decided instead to use the general Markov approach.
Warren Weckesser at Colgate University has made available some <a href="http://math.colgate.edu/~wweckesser/math312Spring05/handouts/MarkovChains.pdf">nice lecture notes</a>,
but note that my transition matrix \(P\) is the transpose of what Weckesser uses,
to match the convention used in some other references below.</p>
<p>Define the transition matrix \(P(i,j) = p_{i,j}\),
which is the probability that the population will transition from \(i\) to \(j\) cooperators.
Reorder the transition matrix into its canonical form,</p>
\[\begin{equation}
P =
\begin{bmatrix}
I & \mathbf{0} \\
R & Q \\
\end{bmatrix},
\end{equation}\]
<p>where, in our case, \(I\) is a \(2 \times 2\) matrix corresponding to the absorbing states \(i=0\) and \(i=n\).
The fundamental matrix</p>
\[\begin{equation}
N = (I - Q)^{-1}.
\end{equation}\]
<p>The \(i\)th row \(NR\) gives the probabilities of ending up in each of the absorbing states (columns)
given that the process started in the \(i\)th transient state.
My Fig. 1 below matches Tutić’s (2021) Fig. 2 and 5.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/03/tutic_1.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/03/tutic_1.png" alt="Figure 1: The fixation probabilities of cooperators obtained from \(NR\)." />
</a>
<figcaption><span>Figure 1: The fixation probabilities of cooperators obtained from \(NR\).</span></figcaption>
</figure>
<p>Tutić (2021) used simulations to explore the long-term dynamical behaviour.
Tutić (2021) reports that, when \(h=5\),
most simulations went to fixation unless the selection was strong, e.g., \(w=0.8\).</p>
<p>\(N(i, j)\) gives the expected number of times that the process is in the \(j\)th
transient state given that it started in the \(i\)th transient state.
Therefore, the sum of the \(i\)th row of \(N\)
gives the expected number of times that the process will be in some transient state
given that the process started in the \(i\)th transient state.</p>
<p>Fig. 2 shows the expected transient times I found using \(N\)
when \(h=5\) and \(w=0.8\) for different initial values of \(i\).
For most initial values, the transient time is quite long,
as Tutić (2021) reports.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/03/tutic_2.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/03/tutic_2.png" alt="Figure 2: The transient times for different initial number of cooperators \(i\).
Parameters \(h=5\) and \(w=0.8\)." />
</a>
<figcaption><span>Figure 2: The transient times for different initial number of cooperators \(i\).
Parameters \(h=5\) and \(w=0.8\).</span></figcaption>
</figure>
<p>When an absorbing Markov chain spends a long time in transient states,
the quasi-stationary behaviour can be characterised using the methods reviewed in van Doorn and Pollett
(2013) and used in e.g., Day and Possingham’s (1995) paper about metapopulation persistence.
Following Day and Possingham (1995),
the left eigenvector corresponding to the maximal eigenvalue \(\mu_1\) of \(Q\) gives the quasi-stationary distribution.
\(\mu_1\) is always less than 1,
and the closer \(\mu_1\) is to 1, the longer the process continues before absorption.
Van Doorn and Pollett (2013)
defines the spectral gap \(\gamma\) as the distance between the two largest eigenvalues,
and if \(\gamma\) is is substantially larger than the decay parameter \(\alpha = 1-\mu_1\),
then the dynamics will exhibit quasi stationary behaviour,
i.e., relatively fast convergence to the limiting conditional distribution, and eventual evanescence after a much longer time.</p>
<p>Fig. 3 shows the quasi-stationary distribution found from the leading left eigenvector of \(Q\).
The expected value matches the expected value Tutić (2021) observed in simulations
(compare with Fig. 6 in Tutić (2021)).
The systems spends most of its time near the all-defector state,
which puts it at risk of eventually losing the cooperators from the population.</p>
<p>I found \(\mu_1 = 0.9999989\),
which is close to 1 and indicates the transient dynamics will continue a long time before fixation.
I found \(\gamma = 5.5 \times 10^{-3}\) and \(\alpha = 1 \times 10^{-6}\),
which indicates quasi-stationary behaviour.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/03/tutic_3.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/03/tutic_3.png" alt="Figure 3: The quasi-stationary distribution. Parameters \(h=5\) and \(w=0.8\)." />
</a>
<figcaption><span>Figure 3: The quasi-stationary distribution. Parameters \(h=5\) and \(w=0.8\).</span></figcaption>
</figure>
<p>The model assumes that, if there is more than one cooperator in the group,
then they will all pay the cost \(\gamma\) to provide the public good.
I wondered, what would happen if only one cooperator provided the good,
e.g., if they draw straws or one is randomly chosen to do the job first,
or if they split the costs between them?</p>
<p>I modified the cooperator payoff</p>
\[\begin{equation}
\pi_c(i, h) = \beta - \sum_{k=0}^{h-1} \frac{\gamma}{k+1} \cdot \frac{ {i-1 \choose k} {n-i \choose h-1-k} }{ {n-1 \choose h-1} },
\end{equation}\]
<p>where the sum is over the number of other group members that are cooperators \(k\),
the first fraction represents the cost of providing the good given that \(k\),
and the second fraction represents the probability of being grouped with \(k\) other cooperators
(hypergeometric distribution again).</p>
<p>In the new model, group size still has a negative effect on fixation probabilities,
but it is less severe than in the original model
and doesn’t have such strong effects when the intial number of cooperators is high (Fig. 4).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/03/tutic_4.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/03/tutic_4.png" alt="Figure 4: The fixation probabilities of cooperators for the new model where costs are split between cooperators." />
</a>
<figcaption><span>Figure 4: The fixation probabilities of cooperators for the new model where costs are split between cooperators.</span></figcaption>
</figure>
<p>A population with an initially modest number of cooperators is now more likely to go to the all-cooperator absorbing state
(Fig. 5).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/03/tutic_5.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/03/tutic_5.png" alt="Figure 5: The fixation probabilities of cooperators for (a) the original model, and (b) the new model where costs are split between cooperators." />
</a>
<figcaption><span>Figure 5: The fixation probabilities of cooperators for (a) the original model, and (b) the new model where costs are split between cooperators.</span></figcaption>
</figure>
<p>However,
the quasi-stationary distribution still spends most of its time near the all-defect absorbing state (Fig. 6).
Therefore, while there is a better chance in the new model that the population will be absorbed to the all-cooperator state,
the overall story that the original Tutić (2021) model tells is still true:
cooperation becomes harder to maintain as group size increases.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/03/tutic_6.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/03/tutic_6.png" alt="Figure 6: Quasi-stationary behaviour in the new model where costs are split between cooperators, (a) transient times, (b) quasi-stationary distribution. \(\gamma = 6.8 \times 10^{-4}\) and \(\alpha = 3.45 \times 10^{-5}\). For parameters \(h=10\) and \(w=0.8\)." />
</a>
<figcaption><span>Figure 6: Quasi-stationary behaviour in the new model where costs are split between cooperators, (a) transient times, (b) quasi-stationary distribution. \(\gamma = 6.8 \times 10^{-4}\) and \(\alpha = 3.45 \times 10^{-5}\). For parameters \(h=10\) and \(w=0.8\).</span></figcaption>
</figure>
<p>The code I used for this blog post is available on Github: <a href="https://github.com/nadiahpk/tutic-2021-playground">tutic-2021-playground</a>.</p>
<h3>References</h3>
<p>Day, J. R. and Possingham, H. P. (1995). A stochastic metapopulation model with variability in patch size and position, Theoretical Population Biology 48(3): 333–360.</p>
<p>Nowak, M. A. (2006). Evolutionary dynamics: exploring the equations of life, Harvard University Press.</p>
<p>Tutić, A. (2021). <a href="https://www.tandfonline.com/doi/abs/10.1080/0022250X.2021.1988946">Stochastic evolutionary dynamics in the volunteer’s dilemma</a>, The Journal of Mathematical Sociology: 1–20.</p>
<p>van Doorn, E. A. and Pollett, P. K. (2013). Quasi-stationary distributions for discrete-state models, European Journal of Operational Research 230(1): 1–14.</p>nadiahkristensenThe purpose of this blog post is to use a recent paper by Tutić (2021) to teach myself about stochastic evolutionary game theory.Using coalescence models to approximate interaction probabilities in weak selection2022-02-01T04:44:54+00:002022-02-01T04:44:54+00:00https://nadiah.org/2021/02/01/antal-weak-selection<p>To calculate the conditions under which selection favours cooperation,
<a href="https://www.pnas.org/doi/pdf/10.1073/pnas.0902528106">Antal et al. (2009)</a>
used interaction probabilities calculated from a coalescence model. However, a coalescence model
is a neutral model, it assumes no selective differences between types. So why can they assume <em>no
selective difference</em> between types in a <em>selective model</em>? The purpose of this blog post is to explore the
explanation detailed in their SI.</p>
<p>First, a quick overview of the paper. The model involves the simultaneous evolution of two traits:
(1) the strategy in a one-shot Prisoner’s Dilemma, either Cooperate or Defect; and (2) a phenotypic
tag, modelled as an integer from \(-\infty\) to \(\infty\). Both the tag and strategy are inherited clonally with
a small chance of mutation, which means individuals who have the same tag are likely to have the
same strategy. The correlation between tag and strategy favours the evolution of cooperation, similar
to the Green Beard concept. If Cooperators only cooperate with other individuals who have the
same tag as themselves, that reduces their chances of being taken advantage of by Defectors. Before
this paper, most tag-based models had found that it was difficult to obtain cooperation for well-
mixed populations, suggesting that some spatial structure was needed. In this paper, however, they
investigate a well-mixed population, and discover a simple benefits/costs condition for cooperation to
evolve: \(\frac{b}{c} > 1 + \frac{2}{\sqrt{3}}\).</p>
<p>They assume a Cooperator only cooperates with a matching-tag partner,
paying cost \(c\) to provide a benefit \(b\) to the partner;
otherwise, it behaves like a Defector.
The Defector contributes nothing;
it receives \(b\) from a partner who cooperators and \(0\) from a partner who defects.
Let \(m_i\) be the number of Cooperators and \(n_i\) be the total number of individuals
(Cooperators + Defectors) with tag \(i\).
The average payoff to a Cooperator is the total payoff divided by the number of Cooperators</p>
\[f_C = \frac{\sum_i m_i (b m_i - c n_i)}{\sum_i m_i},\]
<p>and similarly for Defectors</p>
\[f_D = \frac{\sum_i (n_i - m_i) b m_i }{N - \sum_i m_i}.\]
<p>Selection favours cooperation if Cooperators have higher fitness than Defectors,
\(f_C > f_D\), which is</p>
\[b \sum_i m_i^2 - c \sum_i m_i n_i > \frac{(b-c)}{N} \sum_{ij} m_i m_j n_j.
\label{single_s_condition}
\tag{1}\]
<p>Eq. \ref{single_s_condition} is the equation for a single configuration of the
population \(s = (\mathbf{m}, \mathbf{n})\).
In order to find the condition for evolution of cooperation overall,
we must average this condition over every possible population configuration \(s\).
Let \(\pi(s)\) be the probability that the population finds itself in configuration \(s\).
We’ll indicate the averaging by angle brackets, i.e.,</p>
\[\langle \bullet \rangle = \sum_s \bullet \: \pi(s)\]
<p>Then the condition for the evolution of cooperation is</p>
\[b \Bigg \langle \sum_i m_i^2 \Bigg \rangle - c \Bigg \langle \sum_i m_i n_i \Bigg \rangle > \frac{(b-c)}{N} \Bigg \langle \sum_{ij} m_i m_j n_j \Bigg \rangle.
\tag{Ant.1}
\label{Ant.1}\]
<p>The terms in the angle brackets look like they’d be proportional to probabilities:
the probability of drawing two cooperators with the same tag,
the probability of drawing a cooperator and any other with the same tag,
and a more complicated probability involving three types.</p>
<p>So far, so good.</p>
<p>However,
they say that they are “Averaging these quantities over every possible configuration of the population,
<em>weighted by their stationary probability under neutrality</em>” (emphasis added).
So, if we define every possible population configuration at the neutral-model steady state,
\(\pi^{(0)}(s)\),
and indicate this average by a subscript 0, i.e.,</p>
\[\langle \bullet \rangle_0 = \sum_s \bullet \: \pi^{(0)}(s)\]
<p>then, in fact, they are evaluating</p>
\[b \Bigg \langle \sum_i m_i^2 \Bigg \rangle_0 - c \Bigg \langle \sum_i m_i n_i \Bigg \rangle_0 > \frac{(b-c)}{N} \Bigg \langle \sum_{ij} m_i m_j n_j \Bigg \rangle_0.
\label{avg_at_ss}
\tag{2}\]
<p>Why is it possible to replace the full averaging in Eq. \ref{Ant.1} with the averaging at the neutral steady state
in Eq. \ref{avg_at_ss}?
The answer is given in their SI.</p>
<p>In the SI in Section 3,
for a given population configuration \(s\),
they derive the fitness of the Cooperator with tag \(i\).
Start with the effective payoffs:</p>
\[f_{C,i} = 1 + \delta (b m_i - c n_i)\]
\[f_{D,i} = 1 + \delta b m_i\]
<p>Assume that every individual interacts with every individual once per generation.
Then, the fitness of the Cooperator</p>
\[\begin{align}
w_{C,i}
&= \frac{\text{payoff to Cooperator with tag }i}{\text{payoff to all Cooperators} + \text{payoff to all Defectors}} \\
&= \frac{N f_{C,i}}{\sum_j m_j f_{C,j} + (n_j - m_j) f_{D,j}} \\
&= \frac{1 + \delta(b m_i - c n_i)}{1 + \frac{\delta(b-c)}{N} \sum_j m_j n_j}
\end{align}\]
<p>For brevity, define \(A = b m_i - c n_i\) and \(B = \frac{(b-c)}{N} \sum_j m_j n_j\).
Do a Taylor expansion around \(a = 0\)</p>
\[\begin{align}
w_{C,i}(\delta) &= w_{C,i}(a) + w_{C,i}'(a)(\delta-a) + \frac{w_{C,i}''(a)}{2} (\delta-a)^2 + \ldots \nonumber \\
&= \frac{1+a A}{1+a B} + \left( \frac{A}{Ba + 1} - \frac{B(Aa + 1)}{(B a + 1)^2} \right) (\delta - a) + \mathcal(O)(\delta^2) \nonumber \\
&= 1 + \delta(A-B) + \mathcal{O}(\delta^2) \nonumber \\
&= 1 + \delta \left( bm_i -cn_i - \frac{b-c}{N} \sum_j m_j n_j \right) + \mathcal{O}(\delta^2)
\tag{Ant.SI.30}
\label{Ant.SI30}
\end{align}\]
<p>We can verify that, when selection \(\delta = 0\), the Cooperator’s fitness \(w_{C,i} = 1\), as we’d hope.</p>
<p>For selection to favour Cooperators,
the average change in the proportion of Cooperators due to selection must be greater than zero, i.e.,</p>
\[\langle \Delta p(s) \rangle > 0.
\label{invasion_condition}
\tag{3}\]
<p>For a given population configuration</p>
\[\begin{align}
\Delta p(s)
&= \frac{1}{N} \left( \text{number of Cooperator offspring born} - \text{number of Cooperator adults died} \right) \nonumber \\
&= \frac{1}{N} \left( \sum_i m_i w_{C,i} - \sum_i m_i \right)
\end{align}\]
<p>We can again verify that, when selection \(\delta = 0\), the change due to selection equals 0.
\(\Delta p(s)\) has the Taylor expansion</p>
\[\Delta p(s) = 0+ \frac{\delta}{N} \sum_i m_i \left. \frac{d w_{C_i}}{d\delta} \right|_{\delta=0} + \mathcal{O}(\delta^2)
\tag{Ant.SI.35}
\label{AntSI.35}\]
<p>Recall we want to average over all possible configurations, that is, to find</p>
\[\bigl\langle \Delta p(s) \bigr\rangle = \sum_s \pi(s) \Delta p(s)
\label{how_to_average}
\tag{4}\]
<p>The stationary probabilities can also be Taylor expanded</p>
\[\pi(s) = \pi^{(0)}(s) + \delta \pi^{(1)}(s) + \mathcal{O}(\delta^2)
\tag{Ant.SI.36}
\label{AntSI.36}\]
<p>\(\pi^{(0)}(s)\) is the stationary probability when \(\delta=0\), which is the stationary probability at neutrality.
And \(\pi^{(1)}(s)\) is some very complicated expression that we don’t know about.</p>
<p>But the good news is that, if we substitute Eq. \ref{AntSI.35} and \ref{AntSI.36}
into Eq. \ref{how_to_average},
then the complicated \(\pi^{(1)}(s)\) and higher terms end up multiplied by \(\delta^2\) and higher terms,
and so when \(\delta\) is very small (weak selection), those terms can be dropped:</p>
\[\begin{align}
\bigl\langle \Delta p(s) \bigr\rangle
&= \sum_s \pi(s) \Delta p(s) \\
& = \sum_s
\left[ \pi^{(0)}(s) + \delta \pi^{(1)}(s) + \mathcal{O}(\delta^2) \right]
\cdot
\left[ \frac{\delta}{N} \sum_i m_i \left. \frac{d w_{C_i}}{d\delta} \right|_{\delta=0} + \mathcal{O}(\delta^2) \right]
\\
%& = \sum_s
%\pi^{(0)}(s) \frac{\delta}{N} \sum_i m_i \left. \frac{d w_{C_i}}{d\delta} \right|_{\delta=0}
%+ \pi^{(1)}(s) \frac{\delta^2}{N} \sum_i m_i \left. \frac{d w_{C_i}}{d\delta} \right|_{\delta=0}
%+ \ldots \\
& = \sum_s
\pi^{(0)}(s) \frac{\delta}{N} \sum_i m_i \left. \frac{d w_{C_i}}{d\delta} \right|_{\delta=0}
+ \mathcal{O}(\delta^2) \\
& \approx \sum_s \pi^{(0)}(s) \Delta p(s) \label{neut} \tag{5}
\end{align}\]
<p>Eq. \ref{neut} indicates an average taken over configurations at the neutral steady state, i.e.,</p>
\[\bigl\langle \Delta p(s) \bigr\rangle
\approx \bigl\langle \Delta p(s) \bigr \rangle_0
= \frac{\delta}{N} \biggl\langle \sum_i m_i \left. \frac{d w_{C_i}}{d\delta} \right|_{\delta=0} \biggr \rangle_0\]
<p>Let’s evaluate that term inside the angle brackets</p>
\[\begin{align}
w_{C,i} &= 1 + \delta \left( b m_i - c n_i - \frac{b-c}{N} \sum_j m_j n_j \right) + \mathcal{O}(\delta^2) \nonumber \\
\frac{d w_{C,i}}{d\delta} &= b m_i - c n_i - \frac{b-c}{N} \sum_j m_j n_j + \mathcal{O}(\delta) \nonumber \\
\left. \frac{d w_{C,i}}{d\delta} \right|_{\delta=0} &= b m_i - c n_i - \frac{b-c}{N} \sum_j m_j n_j \nonumber \\
\sum_i m_i \left. \frac{d w_{C_i}}{d\delta} \right|_{\delta=0}
&= b \sum_i m_i^2 - c \sum_i m_i n_i - \frac{b-c}{N} \sum_{ij} m_i m_j n_j
\label{eq99}
\tag{6}
\end{align}\]
<p>Remember that, for selection to favour cooperators, we want our invasion condition \(\langle \Delta p(s) \rangle > 0\)
(Eq. \ref{invasion_condition}), i.e.,</p>
\[\biggl\langle \sum_i m_i \left. \frac{d w_{C_i}}{d\delta} \right|_{\delta=0} \biggr \rangle_0 > 0
\label{eq98}
\tag{7}\]
<p>Substitute Eq. \ref{eq99} into the invasion condition Eq. \ref{eq98} and so some re-arranging</p>
\[b \Bigg \langle \sum_i m_i^2 \Bigg \rangle_0 - c \Bigg \langle \sum_i m_i n_i \Bigg \rangle_0 > \frac{(b-c)}{N} \Bigg \langle \sum_{ij} m_i m_j n_j \Bigg \rangle_0\]
<p>which is the Eq. \ref{avg_at_ss} that they use.</p>
<p>In conclusion, the reason why they can replace the full population configuration with the configurations
at the neutral steady state is because of weak selection and the structure of the game.
Under weak selection, the effect of the game on fitness is scaled by \(\delta << 1\).
The change in the proportion of Cooperators due to selection has no linear term (\(\delta^0\)).
Therefore, when the averaging is done,
the non-neutral terms in the population configurations distribution (\(\delta^1\) and higher) are multiplied by \(\delta\),
which gives them order \(\delta^2\) and higher, and so they can be dropped.</p>
<h3>References</h3>
<p>Antal, T., Ohtsuki, H., Wakeley, J., Taylor, P. D. and Nowak, M. A. (2009). Evolution of cooperation by phenotypic similarity, Proceedings of the National Academy of Sciences 106(21): 8597–8600.</p>nadiahkristensenTo calculate the conditions under which selection favours cooperation, Antal et al. (2009) used interaction probabilities calculated from a coalescence model. However, a coalescence model is a neutral model, it assumes no selective differences between types. So why can they assume no selective difference between types in a selective model? The purpose of this blog post is to explore the explanation detailed in their SI.Island bird diversity not influenced by historical connection to the mainland2022-01-01T04:44:54+00:002022-01-01T04:44:54+00:00https://nadiah.org/2021/12/12/sundaic-birds<p>The number of species on an island generally increases with island size and connectance to the mainland.
However, if an island’s characteristics have changed in the recent past, that pattern will be disrupted.
In <a href="https://onlinelibrary.wiley.com/doi/abs/10.1111/jbi.14293">Keita Sin’s recent paper in Journal of Biogeography</a>,
we tested if that expectation was borne out for birds on the Sundaic islands.
Perhaps surprisingly, we found that it was not.</p>
<p>The number of species on an island is generally determined by immigration and extinction (MacArthur & Wilson, 1967).
Over long timescales,
these two forces reach a stochastic equilibrium, producing the well-known species-richness patterns.
Larger islands permit larger populations that are less likely to go extinct,
and proximity to the mainland and connectance to it (e.g., via stepping-stone islands) increase the chance of colonisation by new species.
As a consequence, larger islands and islands with greater connectance to the mainland have higher species richness.</p>
<p>However, these general species-richness relationships assume static conditions.
If an island has recently decreased in size or connectance to the mainland,
then we would expect it to have more species than similar islands that have not changed
(see <a href="https://nadiah.org/2020/02/22/transient-dynamics-in-neutral-models/">previous blog post</a>).
This is because it takes time for species diversity to decline to reach its new, lower stochastic-equilibrium value.
The mechanism is similar to extinction debt, where there is a time delay between habitat fragmentation and species extinction.</p>
<p>Over the past 20,000 years, sea level changes have changed the size and connectance of Sundaic islands.
During the Last Glacial Maximum, the sea level was about 120 m below its present level, and the Sunda shelf was exposed and formed a large continuous landmass with Asia.
More recently, around 7000 years ago, there was a peak 3-5 m above the current level, and low-lying islands were completely submerged.</p>
<p>The particular ways in which each island changed depends on the specific topology of the shelf around that island.
As a consequence, two islands of similar size and connectance today can have very different histories of size and connection to the mainland,
providing a natural laboratory for macroecological theory.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/01/sunda_map.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/01/sunda_map.png" alt="Figure 1: A map of the study islands. Note the Sunda shelf in light blue. At the Last Glacial Maximum (20,000 years ago), the Sunda shelf was above sea level." />
</a>
<figcaption><span>Figure 1: A map of the study islands. Note the Sunda shelf in light blue. At the Last Glacial Maximum (20,000 years ago), the Sunda shelf was above sea level.</span></figcaption>
</figure>
<p>Previous work has found that historical changes to island characteristics can influence species richness today.
For example, in Baja California, the diversity of lizards was higher than expected in islands that were more recently connected to the mainland (Wilcox, 1978).
Similar results have also been found for certain birds on satellite islands of New Guinea (Diamond, 1972).
However, some studies have found little effect (e.g., Sundaic mammals, Heaney (1984)).</p>
<p>We found that an island’s historical characteristics had little effect on species richness.
Two islands of similar size had similar diversity regardless of how long they had been disconnected from the mainland, or whether they had been recently submerged or not.
This implies that, for Sundaic birds, the stochastic immigration-extinction equilibrium is reached relatively rapidly.
Extinctions occur soon after an island becomes disconnected from the mainland,
and highly dispersive species rapidly colonise islands that had been recently submerged.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2022/01/keita_fig_3.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/01/keita_fig_3.png" alt="Figure 2: The relationship between island species richness and (a) island area, (b) isolation in a 10 km buffer, and (c) distance to the mainland. The best model (by AIC) to explain species richness on islands included these 3 variables. It did not include change in the island's area, time of isolation from the mainland, whether it had been submerged, or whether it was a deep-sea versus shelf island." />
</a>
<figcaption><span>Figure 2: The relationship between island species richness and (a) island area, (b) isolation in a 10 km buffer, and (c) distance to the mainland. The best model (by AIC) to explain species richness on islands included these 3 variables. It did not include change in the island's area, time of isolation from the mainland, whether it had been submerged, or whether it was a deep-sea versus shelf island.</span></figcaption>
</figure>
<p>The one effect of island history was on <em>island endemism</em>: most island endemics were found on deep-sea islands with no historic land connection to the mainland.
This was true even though some shelf islands are currently more isolated today than the deep-sea islands in the dataset.
This implies that,
although birds are a relatively dispersive taxonomic group,
long-distance overwater colonisation is generally unsuccessful in the less dispersive species.</p>
<p>A special note needs to be made about the uniqueness of the dataset collected by Keita and the team.
Although ornithological knowledge of the region is fairly comprehensive,
the overwhelming majority of surveys have concentrated on large islands,
creating a serious bias in the literature.
In contrast, the surveys conducted for this study focused on small islands (less than 10 sq-km),
providing valuable data to test theory across the range of mechanisms that determine island species diversity.</p>
<p><a href="https://onlinelibrary.wiley.com/doi/abs/10.1111/jbi.14293">Sin, Y. C. K., N. P. Kristensen, C. Y. Gwee, R. A. Chisholm, and F. E. Rheindt. 2022. Bird diversity on shelf islands does not benefit from recent land-bridge connections. Journal of Biogeography, 49(1):189–200</a>.</p>
<h3>References</h3>
<p>Diamond, J. M. (1972). Biogeographic kinetics: Estimation of relaxation times for avifaunas of southwest Pacific islands. Proceedings of the National Academy of Sciences of the United States of America, 69(11), 3199–3203</p>
<p>Heaney, L. R. (1984). Mammalian species richness on islands on the Sunda Shelf, Southeast Asia. Oecologia, 61(1), 11–17</p>
<p>MacArthur, R. H., & Wilson, E. O. (1967). The theory of island biogeography. Princeton University Press.</p>
<p>Wilcox, B. A. (1978). Supersaturated island faunas: A species-age relationship for lizards on post-Pleistocene land-bridge islands. Science, 199(4332), 996–998</p>nadiahkristensenThe number of species on an island generally increases with island size and connectance to the mainland. However, if an island’s characteristics have changed in the recent past, that pattern will be disrupted. In Keita Sin’s recent paper in Journal of Biogeography, we tested if that expectation was borne out for birds on the Sundaic islands. Perhaps surprisingly, we found that it was not.Little difference between real food webs and randomly assembled webs2021-12-28T04:44:54+00:002021-12-28T04:44:54+00:00https://nadiah.org/2021/12/28/metaweb-assembly<p>What determines the structure of a food web?
It has long been theorised that food-web assembly is a <em>selective</em> process,
allowing only certain species and interactions to persist in the face of
dynamical stability constraints.
In <a href="https://twitter.com/larysar">Leo Saravia’s</a> recent paper in
<a href="https://besjournals.onlinelibrary.wiley.com/doi/10.1111/1365-2656.13652">Journal of Animal Ecology</a>,
we used a novel test to see if we could detect the signal of this selection.
We compared the structure of real food webs to those of webs randomly assembled from the regional metaweb.
Contrary to theoretical expectations, we found almost no difference between them.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/leo_assembly.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/12/leo_assembly.png" alt="Figure 1: The null food-web assembly model. Species randomly colonise from the metaweb and go extinct in the local web, with the only constraint being that predators cannot persist unless they have at least one prey. We simulated 1000 local networks, and compared the distribution of their network properties to the properties of real webs." />
</a>
<figcaption><span>Figure 1: The null food-web assembly model. Species randomly colonise from the metaweb and go extinct in the local web, with the only constraint being that predators cannot persist unless they have at least one prey. We simulated 1000 local networks, and compared the distribution of their network properties to the properties of real webs.</span></figcaption>
</figure>
<p>Local food webs result from a repeated process of arrival, colonisation, and extinction
by species from the regional pool or metaweb.
That implies that food web structure is determined by two broad factors:</p>
<ol>
<li>the composition of the metaweb,
which provides an ultimate constraint on which species and interactions are possible; and</li>
<li>a complex combination of local selective processes,
which constrains which species and interactions can persist locally.</li>
</ol>
<p>Real food web structure should reflect both these factors.</p>
<p>The food-web assembly process is theorised to be a selective process.
Which regional species can arrive and persist in a web is influenced by
dispersal, environmental filters, biotic interactions, etc.
Of particular interest is the effect of dynamical constraints.
Some theorists hypothesise that the species combinations and network substructures that
destabilise a web will be quickly lost,
leading to an over-representation of stabilising structures in real food webs.</p>
<p>Food webs do tend to have properties that promote stability.
For example, they tend to have a skewed distribution of interaction strengths
and a high frequency of stabilising 3-node sub-networks (motifs).
However, these properties can arise also for other reasons.
Furthermore, without an appropriate baseline for comparison,
it is unclear whether their observed frequency is unusual or unexpected.</p>
<p>The goal of this study was to test for evidence of these selective processes
by comparing the structural properties of real food webs to the expected distribution given the metaweb.
We used the novel approach of randomly assembling model webs by drawing species and
interactions from the empirical metaweb (null assembly model, Fig. 1).
The assembly model permitted colonisation and extinction, required a consumer to have at least one prey,
but it had no habitat nor population dynamic constraints.</p>
<p>Contrary to our expectations,
we found that there were almost no differences between empirical webs
and those resulting from the null assembly model.
Few empirical food webs showed significant differences in their network properties,
motif representations or topological roles.
Furthermore,
real webs did not display any consistent tendency to deviate from expectation in the direction predicted by theory,
particularly when the lakes dataset was included.
For example,
Weddell Sea seems to have unusually high stability,
but the result looks less unusual when the whole dataset is compared (MEing, Fig. 2).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/leo_result1.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/12/leo_result1.png" alt="Figure 2: Comparing structural metrics between real and randomly assembled food webs: trophic coherence, mean maximum eigenvalue, modularity, and mean trophic level. Most structural properties did not differ significantly, and -- contrary to theoretical expectations -- real webs did not display a consistent tendency to deviate in the direction that promotes dynamical stability." />
</a>
<figcaption><span>Figure 2: Comparing structural metrics between real and randomly assembled food webs: trophic coherence, mean maximum eigenvalue, modularity, and mean trophic level. Most structural properties did not differ significantly, and -- contrary to theoretical expectations -- real webs did not display a consistent tendency to deviate in the direction that promotes dynamical stability.</span></figcaption>
</figure>
<p>Our results suggest that local food web structure is not strongly influenced by dynamical nor habitat restrictions.
The structure is inherited from the metaweb.
This also suggests that the network properties typically attributed to stability constraints
may instead be a by-product of assembly from the metaweb.</p>
<p>We caution that the metrics commonly used to summarise food-web structure,
including those associated with stabilising structure,
may be too coarse to detect the true signal of local processes.
For example, generalisations about the relationship between modularity and stability
cannot be made without first characterising the distribution of interaction strengths.</p>
<p>In conclusion,
for the metrics we considered,
food webs are mainly shaped by metaweb structure,
and we did not find good evidence for the influence of local dynamics.
This kind of analysis needs to be expanded to other regions and habitat types to determine
whether it is a general finding.</p>
<p><a href="https://besjournals.onlinelibrary.wiley.com/doi/10.1111/1365-2656.13652">Saravia, L.A., Marina, T.I., Kristensen, N.P., De Troch, M. & Momo, F.R. (2022). Ecological network assembly: how the regional metaweb influences local food webs, Journal of Animal Ecology, In Press.</a></p>nadiahkristensenWhat determines the structure of a food web? It has long been theorised that food-web assembly is a selective process, allowing only certain species and interactions to persist in the face of dynamical stability constraints. In Leo Saravia’s recent paper in Journal of Animal Ecology, we used a novel test to see if we could detect the signal of this selection. We compared the structure of real food webs to those of webs randomly assembled from the regional metaweb. Contrary to theoretical expectations, we found almost no difference between them.Connection between replicator dynamics, Bernstein polynomials, and Bezier curves2021-12-12T04:44:54+00:002021-12-12T04:44:54+00:00https://nadiah.org/2021/12/12/archetti-bernstein<p>A series of papers by <a href="https://jorgeapenas.wordpress.com/">Jorge Peña</a> and others
provide a neat way to characterise the replicator dynamics of two-strategy nonlinear
public goods games with random group formation
(Peña et al. 2014, Peña et al. 2015, Peña & Nöldeke 2016, Nöldeke & Peña 2016, Peña & Nöldeke 2018, Nöldeke & Peña 2020).
I this blog post, I used a paper by <a href="https://www.mdpi.com/2073-4336/9/2/17/htm">Archetti (2018)</a>
to teach myself more about the topic.</p>
<p>Archetti (2018) considered replicator dynamics in a population of producers (cooperators) and defectors.
The probability that \(i\) of the \(n-1\) other members in your group are cooperators is</p>
\[p_{i,n-1}(x) = { n-1 \choose i } x^i (1-x)^{n-1-i}\]
<p>where \(x\) is the proportion of cooperators in the population.
The fitnesses of cooperators and defectors are</p>
\[\begin{align}
W_C &= \sum_{i=0}^{n-1} p_{i,n-1}(x) b(i+1) - c, \\
W_D &= \sum_{i=0}^{n-1} p_{i,n-1}(x) b(i),
\end{align}\]
<p>respectively, where \(b(i)\) is the benefit from the public good and \(c\) is the cost of contributing.
The cooperator gets \(b(i+1)\) to count themselves.
The replicator dynamics are</p>
\[\dot{x} = x(1-x) \beta(x)
\label{dotx}\]
<p>where</p>
\[\beta(x) = \sum_{i=0}^{n-1} p_{i,n-1}(x) \Delta b_i, \quad \text{and} \quad
\Delta b_i = b(i+1) - c - b(i).\]
<p>The \(\Delta b_i\) are also the change in payoff from switching strategy.</p>
<p>The steady states are found when \(\dot{x} = 0\).
There are two trivial steady states, \(x^*=0\) and \(x^*=1\).
Any additional steady states are found by finding the roots \(\beta(x)=0\).
When \(b(i)\) is nonlinear, it can be difficult to solve \(\beta(x) = 0\) analytically.</p>
<p>Archetti (2018) explain how the general shape of \(\beta(x)\) can be determined by harnessing the theory
of Bernstein Polynomials.
A <em>Bernstein polynomial basis</em> of degree \(n\) for \(x = [0,1]\) is</p>
\[p_{i,n}(x) = {n \choose i} x^i (1-x)^{n-i}\]
<p>A <em>polynomial in Bernstein form</em> is</p>
\[F(x) = \sum_{i=0}^n p_{i,n}(x) f_i
\label{F(x)}\]
<p>where \(f_i\) is the <em>Bernstein coefficient</em>.</p>
<p>Comparing the equations above,
it is apparent that \(\beta(x)\) is a polynomial in Bernstein form,
and \(\Delta b_i\) is its Bernstein coefficients:</p>
\[\underbrace{\beta(x) \vphantom{\sum_i^n} }_{F(x)} = \underbrace{\sum_{i=0}^{n-1}}_{\sum_{i=0}^n} \underbrace{p_{i,n-1}(x)\vphantom{\sum_i^n} }_{p_{i,n}}
\underbrace{\Delta b_i\vphantom{\sum_i^n} }_{f_i} \nonumber\]
<p>Archetti (2018) provides a flexible function for \(b_i\),
which can provide a variety linear and highly nonlinear games (e.g., sigmoid, step-function).
The benefit \(b(i)\) from the public good to an individual in a group with \(i\) producers and \((n - i)\) defectors
is</p>
\[b(i) = \frac{l(i) - l(0)}{l(n) - l(0)}, \quad \text{ where } \quad
l(i) = \frac{1}{1 + e^{s(h - i/n)}}.\]
<h3>Some examples</h3>
<p>Consider a game parameterised with \(s = 10\), \(h = 0.4\), \(c = 0.05\).
This produces a sigmoid relationship between the number of cooperators and the benefit from the public good.
Their Fig. 5 shows how the Bernstein coefficients \(\Delta b_i\) compare to \(\beta(x)\).
Please note that I wasn’t able to reproduce their Fig. 5 exactly,
but I will provide all the details so anyone can find where the issue might have been.</p>
<p>Start with the simplest example, \(n=2\).
Substituting the parameters into the equations for \(l(i)\) and \(b(i)\) above,
I obtained</p>
\[l(0) = 0.018, \quad l(1) = 0.731, \quad l(2) = 0.998, \quad b(0) = 0, \quad b(1) = 0.728, \quad b(2) = 1\]
<p>The Bernstein coefficient \(\Delta b_i = b(i+1) - c - b(i)\),
which results in:</p>
\[\Delta b_0 = 0.678, \quad \Delta b_1 = 0.222.
\label{two_only}\]
<p>Any interior equilibria are found as the roots of</p>
\[\beta(x) = \sum_{i=0}^{n-1} { n-1 \choose i } x^i (1-x)^{n-1-i}\]
<p>which, for \(n=2\), results in the linear equation</p>
\[\beta(x) = \Delta b_0 + x(\Delta b_1 - \Delta b_0),\]
<p>with endpoints:</p>
\[\beta(x=0) = 0.678, \quad \beta(x=1) = 0.222.\]
<p>Fig. 1 compares \(\Delta b_i\) and \(\beta(x)\), and the two lines lie on top of each other.
The reason for this is because, when \(n\) is only 2, \(\beta(x)\) is linear,
and also because of the endpoints property of Bernstein polynomials:</p>
<blockquote>
<p>The initial and final values of \(f\) and \(F\) are the same: \(F(0) = f_0\); \(F(1) = f_n\).</p>
</blockquote>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/Fig5_n2.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/12/Fig5_n2.png" alt="Figure 1: Comparing the linear spline formed of the Bernstein coefficients and beta(x) for n=2." />
</a>
<figcaption><span>Figure 1: Comparing the linear spline formed of the Bernstein coefficients and beta(x) for n=2.</span></figcaption>
</figure>
<p>We know that in two-strategy two-player games with replicator dynamics,
the Nash Equilibria are equivalent to the replicator stable steady states,
and the coefficients are the change in payoff from switching strategies.</p>
<p>Fig. 2 compares \(\Delta b_i\) and \(\beta(x)\) for a variety of \(n\).
Two interesting properties are illustrated here.
First,
the \(\Delta b_i\) linear spline preserves the shape of \(\beta(x)\).
Across these examples and the additional ones in Archetti (2018),
we find that when \(\beta(x)\) is convex, concave, or monotone,
the \(\Delta b_i\) linear spline is likewise convex, concave, or monotone.</p>
<p>The second interesting property is that,
as \(n\) increases, the agreement between
\(\Delta b_i\) and \(\beta(x)\) improves.
This is another property of Bernstein polynomials:
the coefficients are an approximation of the continuous function, which improves as \(n \rightarrow \infty\).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/Fig5_othern.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/12/Fig5_othern.png" alt="Figure 2: Comparing the linear spline formed of the Bernstein coefficients and beta(x) for higher n." />
</a>
<figcaption><span>Figure 2: Comparing the linear spline formed of the Bernstein coefficients and beta(x) for higher n.</span></figcaption>
</figure>
<p>An intuitive way to understand the shape-preserving and convergence properties is by understanding that the Bernstein polynomial
is a <a href="https://en.wikipedia.org/wiki/B%C3%A9zier_curve">Bezier curve</a> and the coefficients are the control points.
Below is an animation of a Bezier curve with 3, 4, and 5 control points from its Wikipedia page.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/Bezier_2_big.gif">
<img src="/wp-content/uploads/2021/12/Bezier_2_big.gif" align="left" width="30%" />
</a>
<a href="/wp-content/uploads/2021/12/Bezier_3_big.gif">
<img src="/wp-content/uploads/2021/12/Bezier_3_big.gif" align="left" width="30%" />
</a>
<a href="/wp-content/uploads/2021/12/Bezier_4_big.gif">
<img src="/wp-content/uploads/2021/12/Bezier_4_big.gif" width="30%" />
</a>
<br />
<figcaption><span>Figure 3: Examples of Bezier curves with 3, 4, and 5 control points. Contributed to the public good by Phil Tregoning.</span></figcaption>
</figure>
<p>Fig. 4 shows how \(\beta(x)\) is drawn as a Bezier curve using the \(\Delta b_i\) as control points.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/Fig5_bezier.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/12/Fig5_bezier.png" alt="Figure 4: Drawing the n=5 Bezier curve at x=1/4 and x=1/2." />
</a>
<figcaption><span>Figure 4: Drawing the n=5 Bezier curve at x=1/4 and x=1/2.</span></figcaption>
</figure>
<h3>Characterising the dynamics</h3>
<p>On page 5,
Archetti (2018) detail how the Bernstein approach can be used to characterise
the dynamics of the sigmoid game above.
An important point to note is that finding the interior equilibria, i.e., the roots \(\beta(x)\),
cannot be done from \(\Delta b_i\) alone (i.e., their first two bullet points involving conditions on \(\beta_{\text{MAX}}\)).
A small example illustrates.</p>
<p>Consider the same game above, with \(n=10\), but now we increase the cost of contribution \(c\) from
0.05 to \(c=0.2\).
In effect, this shifts the axis up and places it between the two curves.
Fig. 5 compares the \(\Delta b_i\) spline to \(\beta(x)\).
In this case, the spline has two interior roots but \(\beta(x)\) has none.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/Fig5_n10_break.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/12/Fig5_n10_break.png" alt="Figure 5: An example where the Bernstein coefficients suggest interior roots but
beta(x) does not have interior roots." />
</a>
<figcaption><span>Figure 5: An example where the Bernstein coefficients suggest interior roots but
beta(x) does not have interior roots.</span></figcaption>
</figure>
<p>It seems to me that the <em>non-existence</em> of roots of the \(\Delta b_i\) spline might tell you about the non-existence
of interior equilibria in this case, but not the reverse.
Perhaps this might be true for convex and concave pairs of roots in general,
if I understand the shape-preserving property correctly.</p>
<h3>Three or more strategies</h3>
<p>Towards the end of the paper,
Archetti (2018) write that nonlinearities are clearly important for games with more than two strategies,
but analysis remains problematic for these games.</p>
<p>One generalisation of the Bernstein approach that would suit replicator dynamics is the Bernstein polynomial on the simplex.
Its basis is the multinomial distribution (see, e.g., Definition 1 from Bayad et al. (2011)).
The coefficients preserve <em>axial</em> convexity,
which means the function is convex in any direction parallel to the edges of the simplex (Dahmen 1991, Sauer 1991).</p>
<p>The replicator dynamics of an \(m\)-strategy game can be put into Bernstein polynomial form.
Index the strategies \(s_1, \ldots, s_{m}\)
with payoffs \(\pi_{i}(\mathbf{k})\) to a focal \(s_i\)-strategist,
where \(\mathbf{k} = [k_{1}, k_{2}, \ldots, k_{m}]\) is the <em>total</em> number of group members
(i.e., including the focal player) with strategies \(s_1, s_2, \ldots, s_m\).
Let \(\mathbf{p} = [p_1, \ldots, p_m]\) be the proportions of different strategists in the population.
Let \(\mathbf{e_i}\) be a vector with 1 in position \(i\) and 0 elsewhere.</p>
<p>Define the set of all possible group compositions</p>
\[K = \left\{ \mathbf{k} \, \middle\vert \, \sum_{j=1}^m k_{j} = n \right\}.\]
<p>Then the dynamics of \(x\)-strategists is proportional to</p>
\[\Delta p_x \propto p_x
\underbrace{\sum_{\mathbf{k} \in K} \underbrace{
\vphantom{ \sum_{i=1}^m }
P(\mathbf{k} \mid n, \mathbf{p})}_{\text{Bernstein basis}}
\underbrace{
\left(
\sum_{i=1}^{m}
k_{i} ( \pi_{x}(\mathbf{k} - \mathbf{e}_i + \mathbf{e}_x) - \pi_{i}(\mathbf{k}) )
\right)
}_{\text{Bernstein coefficient}}.}_{\beta}
\label{interior_bernstein}\]
<p>Again we see that the Bernstein coefficient is related to the change in payoffs when an individual switches strategy,
which provides some kind of connection to the NE.</p>
<h4>An example</h4>
<p>Sigmund et al. (2010) modelled evolution by social learning in a PGG with a variety of different
punishment regimes.
They showed that,
when punishment was implemented via an institution that punished both non-contributors to the
PGG as well as non-contributors to the institution (e.g., non-payers of tax),
then cooperation could be sustained.</p>
<p>I included only three of the types from their model, excluding the ‘loner’ type that is needed for
punishers to invade.</p>
<p>(1) Cooperators (\(x\)), who contribute to the public good but not to the punishment pool,
have payoff</p>
\[\pi_x = \frac{r c (k_x + k_v) }{n-1}- c - B k_v.\]
<p>(2) Defectors (\(y\)), who don’t contribute to anything, have payoff</p>
\[\pi_y = \frac{r c (k_x + k_v) }{n-1} - B k_v.\]
<p>(3) Punishers (\(v\)), who contribute to both the public good and the punishment institution,
have payoff</p>
\[\pi_v = \frac{r c (k_x + k_v) }{n-1} - c - G.\]
<p>I used their default parameter values: \(n = 5, r = 3, c = 1, B = G = 0.7\).</p>
<p>Fig. 6 summarises the replicator dynamics of the model.
As described in their paper,
when the institution metes out both 1st and 2nd-order punishment, a population of punishers is stable.
However, punishers cannot invade unless their initial population is above some certain threshold.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/sigmund_replicator.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/12/sigmund_replicator.png" alt="Figure 6: The replicator dynamics for the Sigmund model example. Created using egtsimplex" />
</a>
<figcaption><span>Figure 6: The replicator dynamics for the Sigmund model example. Created using egtsimplex</span></figcaption>
</figure>
<p>Fig. 7 compares the Bernstein coefficients to the full \(\beta\) function for the Sigmund model.
The blue surface \(\beta\) matches the dynamics in Fig. 6 above,
and the coefficients preserve the shape of \(\beta\).
The two functions match at the endpoints (\(X=1\), \(Y=1\), \(V=1\)).
Sigmund modelled an underlying linear game between cooperators and defectors,
so \(\beta\) on the \(X\)-\(Y\) is linear and the line lies on top of the coefficients.
Otherwise,
the coefficients match the axial convexity in the directions parallel to
the \(X\)-\(V\) and \(Y\)-\(V\) axes.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/12/sigmund_bernstein.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/12/sigmund_bernstein.png" alt="Figure 7: Comparing the linear mesh formed of the Bernstein coefficients (black) and the surface
of the beta (blue) for the Sigmund model example. The flat triangle is the simplex axes where the coefficients
and beta equal 0." />
</a>
<figcaption><span>Figure 7: Comparing the linear mesh formed of the Bernstein coefficients (black) and the surface
of the beta (blue) for the Sigmund model example. The flat triangle is the simplex axes where the coefficients
and beta equal 0.</span></figcaption>
</figure>
<h3>References</h3>
<p>Archetti, M. (2018). <a href="https://www.mdpi.com/2073-4336/9/2/17/htm">How to analyze models of nonlinear public goods</a>, Games 9(2): 17.</p>
<p>Bayad, A., Kim, T., Lee, S. H., & Dolgy, D. V. (2011). A note on the generalized Bernstein polynomials. Honam Mathematical Journal, 33(3), 431-439.</p>
<p>Dahmen, W. (1991). Convexity and Bernstein-Bézier polynomials, in P.-J. Laurent, A. Le Méhauté and L. L. Schumaker (eds), Curves and Surfaces, Academic Press, pp. 107–134.</p>
<p>Nöldeke, G. & Peña, J. (2016). The symmetric equilibria of symmetric voter participation games with complete information. Games and Economic Behavior, 99, 71–81.</p>
<p>Nöldeke, G. & Peña, J. (2020). Group size and collective action in a binary contribution game. Journal of Mathematical Economics, 88, 42–51.</p>
<p>Peña, J., Lehmann, L. & Nöldeke, G. (2014). Gains from switching and evolutionary stability in multi-player matrix games. Journal of Theoretical Biology, 346, 23–33.</p>
<p>Peña, J., Nöldeke, G. & Lehmann, L. (2015). Evolutionary dynamics of collective action in spatially structured populations. Journal of Theoretical Biology, 382, 122–136.</p>
<p>Peña, J., & Nöldeke, G. (2016). Variability in group size and the evolution of collective action. Journal of Theoretical Biology, 389, 72-82.</p>
<p>Peña, J., & Nöldeke, G. (2018). Group size effects in social evolution. Journal of Theoretical Biology, 457, 211-220.</p>
<p>Sauer, T. (1991). Multivariate Bernstein polynomials and convexity, Computer Aided Geometric Design 8(6): 465–478.</p>
<p>Sigmund, K., De Silva, H., Traulsen, A. and Hauert, C. (2010). Social learning promotes institutions for governing the commons, Nature 466(7308): 861.</p>nadiahkristensenA series of papers by Jorge Peña and others provide a neat way to characterise the replicator dynamics of two-strategy nonlinear public goods games with random group formation (Peña et al. 2014, Peña et al. 2015, Peña & Nöldeke 2016, Nöldeke & Peña 2016, Peña & Nöldeke 2018, Nöldeke & Peña 2020). I this blog post, I used a paper by Archetti (2018) to teach myself more about the topic.Cooperation and maladaptation2021-11-18T01:44:54+00:002021-11-18T01:44:54+00:00https://nadiah.org/2021/11/18/maladaptation<p>Humans often cooperate in experimental games even when it’s not the strategy that will win them the most money
(Ledyard, 1995; Cadsby and Maynes, 1999).
They do this in one-shot games, where there is no chance the other could punish them if they took advantage,
and in games with anonymous strangers, for whom they have no material reason to care.
We see this cooperative tendency typically in the initial rounds of experimental public goods games (e.g., Offerman et al. 1996),
but also in real-world common-resource problems (Ostrom 2000).
From a naive economic or Darwinian perspective,
which expects humans to behave in a mostly rational and self-interested way,
this behaviour is puzzling.</p>
<p>One explanation is that this cooperative behaviour is basically a mistake,
either the result evolutionary adaptation to past environments or social heuristics learnt through daily life.
What is fitness- or payoff-maximising in those environments gets misapplied to novel environments like the lab.
This may also explain human cooperation in modern society, which is often in one-off interactions and with complete strangers.</p>
<p>The evolutionary maladaptation hypothesis
(reviewed in Boyd and Richerson, 2006; El Mouden et al., 2012; Raihani and Bshary, 2015)
typically assumes that humans are instead adapted to life in small social groups with high relatedness
(e.g. Johnson et al., 2003).
However, some authors make a maladaptation argument about different assumptions and selection pressures,
such as cooperation as a way to signal quality of parental investment
or the result of the development of deadlier weapons (Phillips, 2015).
The hypothesis goes by various names,
including the mismatch hypothesis (Hagen and Hammerstein, 2006),
the evolutionary legacy hypothesis (Burnham and Johnson, 2005),
and the big mistake (Raihani and Bshary, 2015).
It is also an old hypothesis;
Boyd and Richerson (2006) cite Alexander (1974, 1987), Hamilton (1975), and Tooby and Cosmides (1989) as their earliest sources.</p>
<p>There are three basic ingredients required for the maladaptation hypothesis to work.
First,
the proximate mechanism of cooperative behaviour needs to be based rules or dispositions of a general nature,
rather than determined on a purely case-by-case basis (Güth and Kliemt, 1998).
There seems to be good evidence that humans have domain-specific cognition specifically for social situations
(Tooby and Cosmides, 1992).
For example, people find it easier to solve a logic problem called the
<a href="https://en.wikipedia.org/wiki/Wason_selection_task">Wason card selection test</a>
if the logic of the problem is framed in terms of social contracts (Sugiyama et al., 2002; Stone et al., 2002).
Vervet monkeys also show clearer logic in social than non-social problems
(Cheney and Seyfarth (1990); cited in Boyd and Richerson (2006)).
A general-nature mechanism is also needed when the cause is social heuristics rather than genetic.
For example, in the dual-process model of decision-making,
the intuitive behaviour is shaped by social heuristics resulting from the individual’s past experiences (Rand, 2016).
Either way,
we should expect that humans’ ability to use an appropriate reasoning strategy
will depend upon the way in which the game is framed (Haselton et al., 2015),
and there is plenty of evidence for that (e.g., Hsu (2003), Cartwright et al. (2019)).</p>
<p>The second ingredient needed is an adaptively relevant ancestral environment that would have selected for the behaviour.
What the ‘adaptively relevant environment’ is depends on which trait we’re considering (Burnham, 2013).
Typically (though not always),
the maladaptation hypothesis is premised on a social environment
of humans living in small groups comprised mostly of kin.
This was true for about 95% of our species’ history (Hill et al., 2011 cited in Rusch (2018)).
However, there is some argument (below) about whether relatedness was high enough and migration low enough to have selected for the kinds of behaviours that are observed.</p>
<p>The third ingredient is change that was recent and rapid enough that humans have not yet had the chance to adapt.
A nice analogous example is humans’ preferences for salty, fatty and sweet foods (e.g., Burnham and Johnson, 2005).
These food preferences would have been adaptive in our evolutionary past,
but in the modern environment they are mostly maladaptive.
Similarly, it is argued that the cultural changes that have taken place during the past 10,000 years,
particularly increased group size and frequent encounters with strangers,
have occurred far too quickly for human behaviour to adapt (Barrett et al. (2002) cited in Phillips (2015)).</p>
<p>Evidence for various maladaptation hypotheses comes from manipulation experiments in laboratory games.
For example,
exposing experimental subjects to pictures of stylised eyes will increase cooperative behaviour
(the watching-eye effect, Haley and Fessler (2005)).
This points to an unconscious mechanism that is alert for cues that others are watching,
which is consistent with the indirect reciprocity (reputation) hypothesis.
Arguably, there were few circumstances in the ancestral environment that involved truly anonymous interactions
(Hagen and Hammerstein, 2006).
Therefore, if humans did not evolve in a selective environment of frequent interaction with strangers,
then there is no reason to expect them to maximise their payoff in laboratory games with strangers
(Hagen and Hammerstein, 2006).
Another example comes from a meta-analysis of the body of experimental work performed by Balliet et al. (2014).
They found that the results from experimental manipulations in laboratory-based games
were consistent with the hypothesis of bounded generalised reciprocity,
i.e., indirect reciprocity with ingroup members (Yamagishi and Mifune, 2008).</p>
<p>The above discussion concerns genetic maladaptation,
but the same general principles apply to the non-genetic case,
where learned experience is encoded as social heuristics.
Standard rational choice theory assumes that individuals can ‘jump’ to the utility-maximising strategy;
but in reality, humans typically arrive at a solution gradually through an adaptive learning process (Güth and Kliemt, 1998).
There are examples of this in the review by Cadsby and Maynes (1999),
where participants in threshold PGGs seemed to adjust their behaviour over rounds towards the Nash Equilibrium.</p>
<p>The best evidence for social heuristics comes from cross-cultural studies,
where game behaviour can often be connected to daily-life experience (Henrich et al., 2005).
For example,
Orma people connected an experimental PGG to <em>harambee</em>,
which is their real-life cultural practice for raising funds for community projects.
They correspondingly made higher contributions in the experimental PGG than comparable cultures
without a similar cultural practice.</p>
<p>The cross-cultural studies highlight three points.
First,
they demonstrate that cultural environment is important to determining behaviour in one-shot games / initial rounds.
Variation between cultures was probably not because intrinsic altruistic preferences varied,
but because the cognitive heuristics resulting from the cultural environment varied (Heintz, 2005).
Second, framing matters.
It was Orma people themselves who started calling the PGG the <em>harambee game</em>,
and they behaved accordingly.
This mirrors framing effects observed with Western subjects.
For example,
people will contribute more to a ‘community game’ than a ‘Wall Street game’
(Ross and Ward (1996) and Pillutla and Chen (1999) cited in (Henrich et al., 2005)).
Third,
there are likely multi-layered explanations for behaviour.
The real-life <em>harambee</em> includes a punishment element,
which makes it likely that the real-life Nash Equilibrium is to contribute to the public good.
Therefore, Binmore (2005) argued that initial cooperative behaviour in the lab,
although a violation of the expectations from game-theoretic analysis in the lab setting,
may yet be the result game-theoretic mechanisms that drove learned behaviour or cultural norms towards that Nash equilibrium
in the real world.</p>
<h2>Case study: the strong reciprocity debate</h2>
<p>Much of the literature I found discussing the maladaptation hypothesis
took place in the context of a debate about strong reciprocity.
Strong reciprocity is the observation that people will repay favours and punish non-cooperators
even in anonymous one-shot encounters with genetically unrelated strangers (key reference: Fehr and Henrich (2003)).
The emphasis is typically on the punishment aspect of the behaviour.
Strong-reciprocity theorists argued that
this behaviour could not be explained as a maladaptation resulting from individual selection,
and favoured a cultural group selection explanation instead.
Other authors argued back that maladaptation was a sufficient explanation,
or took issue with perceived misunderstandings of the maladaptation hypothesis
(one good summary is found in Hagen and Hammerstein (2006)).
Therefore, this literature provided me with an opportunity to learn common arguments and misunderstandings that can arise.
Below, I highlight 5.</p>
<p><strong>(1) Mistake = Misunderstanding?</strong>
One objection that strong-reciprocity theorists made to the maladaptation argument is that
it seemed to imply that experimental subjects misunderstood the game.
The maladaptation argument is premised on the idea that, in the adaptively relevant environment,
there is a good chance that games are not truly one-shot and anonymous, even if they seem to be.
However, post-experiment surveys suggest that subjects really did believe what experimenters tell them about the conditions
(Fehr and Henrich, 2003).
For example, 96% of subjects in an ultimatum game reported that they believed experimenters
that their identities would stay anonymous.
Further,
Fehr and Henrich (2003) interpret the speed with which subjects change strategies in response to changing game conditions
as evidence that their behaviour is “mediated by sophisticated, conscious, cognitive acts”
as opposed to “a cognitively inaccessible mechanism drives the baseline pattern of reciprocal responses”
(but see Rand (2016) regarding how speed of decision affects cooperation).</p>
<p>However,
the fact that subjects understand the game and believe it is anonymous
does not rule out maladaptation as an explanation.
In one memorable analogy,
Hagen and Hammerstein (2006) pointed out that people are still aroused by pornography
even though they know they will never have contact with any of the subjects.</p>
<p>This made me wonder what exactly is this proximate mechanism that can override intellectual understanding.
One possible mechanism is happiness — broadly defined (El Mouden et al., 2012).
In the case of strong reciprocity,
we might feel happy to punish someone we think deserved it,
and that warm glow may outweigh the price we paid to do so.
The important thing to keep in mind is that, here, happiness is a proximate — not ultimate — goal;
it is the means to an inclusive-fitness-maximising end in the context of the adapatively relevant ancestral environment.
El Mouden et al. (2012) had a rather nice way of putting it [paraphrased]:</p>
<blockquote>
<p>Humans are free to do what they want, but they are not free to want what they want</p>
</blockquote>
<p>Another possible proximate mechanism is commitment (Akdeniz and van Veelen, 2021).
The commitment mechanism has a particularly clear logic in the ultimatum game,
where the proposer’s knowledge of the responder’s commitment to a fair outcome forces the proposer to make a fair proposal.
Akdeniz and van Veelen (2021) suggest that a similar logic may also apply to strong reciprocity,
e.g., a commitment to punish defectors in a PGG.
One thing I find very appealing about the commitment mechanism is that irrational behaviour and ‘mistakes’ are a necessary feature.
After all,
it’s not really a moral commitment if you change your mind depending on the circumstances (c.f. Atran, 2017).
Therefore, it will behave exactly like what we observe.</p>
<p><strong>(2) Poorly tuned yet responsive?</strong>
The second objection is that there seems to be a contradiction between saying,
on one hand,
that cooperative behaviour is poorly tuned to cues about who is a stranger / kin,
while on the other, observing responsiveness to very subtle cues like fake watching eyes.
Fehr and Henrich (2003) state this very strongly:
“Indirect reciprocity can only account for cooperation in one-shot encounters
if our behavioral rules are not contingent upon the likelihood that our actions will be observed by others”.</p>
<p>One counter-argument is basically that proximate cue-response mechanisms are tuned, but not perfectly
(Burnham and Johnson, 2005).
For example, regarding indirect reciprocity above,
Hagen and Hammerstein (2006) argue that
it’s unlikely that there were many interactions in ancestral environments that were truly anonymous,
therefore the response will be poorly tuned to that scenario.
In addition, error management theory predicts a bias away from making the more costly error (Haselton et al., 2015).
It is plausible that the risk to one’s reputation from cheating once and being observed
is greater than the payoff difference that one could earn by cheating.</p>
<p>However, this counter-argument hinges on some assumptions about the adaptively relevant ancestral environment:–</p>
<p><strong>(3) The adaptively relevant ancestral environment.</strong>
The third objection is that the typical assumption
— that humans evolved in isolated groups with close kin and known individuals (e.g., Johnson et al. (2003))
— is wrong.
Phillips (2015) cites Hill et al. (2011) saying that,
in modern hunter-gatherer societies, “most individuals are unrelated and regularly change membership of groups”.
Fehr and Henrich (2003) also argue that encounters with strangers were common,
pointing to evidence such as the existence of rituals used to bring strangers peacefully into a camp.
If the relevant human ancestral environmental offered a wide range of social scenarios
— including interactions with zero probability of repeating — then it should
have selected against the kinds of one-shot, anonymous cooperation we see in the lab.</p>
<p>I have difficulty knowing whether this argument is likely or not without something to quantify it.
Ideally, someone would have estimated the likely range of degrees of assortativity and used that to parameterise a good model.
So far, I read one paper by Rusch (2018) who did something like that.
They used the relatedness measured in hunter-gatherers horticulturalist societies
(including that of Hill et al., (2011) cited above) to parameterise a linear one-shot PGG model,
and found that cooperation can be maintained in group sizes much larger than previously be thought.
But most models I’ve read have a fixed scenario,
and this question needs a model that looks at scenario variability and some kind of
cue-response / phenotypic plasticity.</p>
<p><strong>(4) Regarding kin selection</strong>
Strong reciprocity theorists raised a series of objections against kin-selection explanations specifically.</p>
<p>Fehr and Henrich (2003) argued that behavioural anomalies cannot be the result of misfiring of kin recognition
because humans can readily distinguish kin from non-kin.
Humans and other animals use three cues to identify kin:
(1) physical similarity (including looks and smell);
(2) familiarity; and
(3) proximity of residence (reviewed in Kurland and Gaulin 2005; cited in Krebs (2015)).
However, kin recognition can misfire.
Boyd and Richerson (2006) give two examples of misfiring,
both cases where raising unrelated children together triggers their incest avoidance cue-response:
the reluctance of Israeli Kibbutz age mates to marry;
and the low reproductive success of Taiwanese minor marriages,
where parents arrange a future spouse for their child by adopting an opposite-sex child and rearing them together.
But note they provided both these examples while writing in support of Fehr and Henrich (2003)’s arguments.</p>
<p>Strong-reciprocity theorists agree that kinship plays a role in cooperation.
I’ve read elsewhere that both foragers and nomadic herders build groups based on kinship, both real and imagined (Næss, n.d.),
and social psychologists have found that kinship cues increase prosocial behaviour (Krebs, 2015).
Rather, it seems that they are questioning whether these cues can misfire
consistently and to such a degree that would support human-style cooperation.</p>
<p>Richerson and Boyd (1999) argue that when kin selection is scaled up to large scales,
it has very different qualities from what we observe in humans.
For example, cooperation in social insects is retained by high relatedness within groups and produces a sterile worker caste.
Further, human cooperation is vulnerable to nepotistic exploitation, not supported by it,
as evidenced by the crime rates in societies that are organised in such a way.</p>
<p>Evidence in support of objections 3 and 4 above also comes from comparisons with nonhuman primates.
Other primates have similar levels of relatedness and migration between groups to human hunter-foragers,
yet they do not show the kind of non-selective altruism suggested by the maladaptation hypothesis,
and are instead very sensitive to differences in relatedness (Boyd and Richerson, 2006).
Further, other primates do not mistakenly cooperate in novel social environments,
e.g., when forced into larger social groups in zoos (Fehr and Henrich, 2003).
Fehr and Henrich (2003) writes: “For the same reason that humans mistakenly cooperate in the modern context,
the maladaptation hypothesis predicts that nonhuman primates should “mistakenly” cooperate in such novel social environments”.
I note that it is possible that this literature is out of date now and that cooperation with strangers occurs in other primates
(e.g., Schmelz et al. (2017) to read),
though it’s obviously not to the degree that humans do.
A good explanation for human cooperation should also explain
why the same degree of cooperation did not evolve in them too.</p>
<p><strong>(5) Coexistence of different types</strong>
The final argument is that
the maladaptation hypothesis doesn’t explain the observed inter-individual variability in cooperative behaviour.
Fehr and Henrich (2003) observe that
human populations seem to be split into
a certain proportion of individuals who are strong reciprocators and another proportion who are selfish.
They ask: “How can the maladaptation account explain the existence of completely self-interested behavior?
If the maladaptation account is correct, why do we not observe everybody engaging in strongly reciprocal behavior?”.
I haven’t yet looked into the details of this inter-individual variation,
but I found a suggestion in Stephens (2005) that there is a cooperative-behaviour polymorphism in humans,
and Burnham (2013) cites evidence that behaviour is heritable
in the ultimatum game (Wallace et al., 2007) and trust-game (Cesarini et al., 2008).</p>
<p>Taken at face value, I didn’t understand Fehr and Henrich (2003)’s argument;
however, I think I might understand if I reinterpret their argument as being about the need for a
group-based explanation.
A polymorphism is not a problem for a maladaptation argument.
We know from e.g., social-learning models
that a possible evolutionary steady state is a polymorphism between cooperators and punishers
(or contributors to a punishment institution).
Therefore, there doesn’t seem to be anything about coexistence of different types that rules out (mal)adaptation.
However, some authors (e.g., Sober and Wilson) use the label ‘group selection’
for mechanisms similar to what we might model using Wright’s Infinite Islands.
The mechanism is still individual selection — and that’s how you model it —
but there is perhaps a sense that the islands are groups that are competing.
Actually, the mechanism is usually that competition between individuals is being exported outside the group
(Taylor 1992; West et al., 2006),
and the kinds of social-learning type models that can produce polymorphism
(a recent example might be García & Traulsen (2019))
also work by exporting competition (imitation is global).
Therefore, I think what Fehr and Henrich (2003) are saying is that the polymorphism that is observed
in real humans looks similar to what is predicted by these ‘group selection’ models;
therefore, the likely explanation probably involves a similar mechanism.</p>
<p><strong>I took home 5 key messages from the strong-reciprocity debate</strong>:</p>
<ol>
<li>Regardless of which hypothesis for human cooperation one favours,
the cooperative behaviour observed in the experimental games is a maladaptation.</li>
<li>Maladaptation does not mean that subjects misunderstand how the game works.</li>
<li>But maladaptation does require an adaptively relevant environment that didn’t select against the behaviour observed.</li>
<li>A good explanation should also address why other primates do not show the same level of cooperation as humans.</li>
<li>The qualitative features of human cooperation should be consistent with what we would expect if the proposed mechanism was ‘scaled up’ to modern-sized societies.</li>
</ol>
<h2>References</h2>
<p>Akdeniz, A. and van Veelen, M. (2021). The evolution of morality and the role of commitment, Evolutionary Human Sciences 3: e41.</p>
<p>Atran, S. (2017). Scott Atran on sacred values. URL: http://traffic.libsyn.com/socialsciencebites/AtranMixSesM.mp3?dest-id=92667</p>
<p>Balliet, D., Wu, J. and De Dreu, C. K. (2014). Ingroup favoritism in cooperation: A meta-analysis., Psychological Bulletin 140(6): 1556.</p>
<p>Binmore, K. (2005). Economic man–or straw man?, Behavioral and Brain Sciences 28(6): 817–818.</p>
<p>Boyd, R. and Richerson, P. J. (2006). Solving the puzzle of human cooperation, in S. C. Levinson and P. Jaisson (eds), Evolution and culture: A Fyssen Foundation Symposium, MIT Press, Cambridge, MA, pp. 105–132.</p>
<p>Burnham, T. C. (2013). Toward a neo-Darwinian synthesis of neoclassical and behavioral economics, Journal of Economic Behavior & Organization 90: S113–S127.</p>
<p>Burnham, T. C. and Johnson, D. D. (2005). The biological and evolutionary logic of human cooperation, Analyse & Kritik 27(1): 113–135.</p>
<p>Cadsby, C. B. and Maynes, E. (1999). Voluntary provision of threshold public goods with continuous contributions: experimental evidence, Journal of Public Economics 71(1): 53-73.</p>
<p>Cartwright, E., Stepanova, A. and Xue, L. (2019). Impulse balance and framing effects in threshold public good games, Journal of Public Economic Theory 21(5): 903–922.</p>
<p>El Mouden, C., Burton-Chellew, M., Gardner, A. and West, S. A. (2012). What do humans maximize?, in S. Okashi and K. Binmore (eds), Evolution and Rationality: Decisions, Cooperation and Strategic Behaviour, Cambridge University Press, Cambridge, pp. 23–49.</p>
<p>Fehr, E. (2003). The puzzle of human cooperation, Nature 421: 912.</p>
<p>Fehr, E. and Henrich, J. (2003). Is strong reciprocity a maladaptation?, in P. Hammerstein (ed.), Genetic and Cultural Evolution of Cooperation, MIT Press, Cambridge, Massachusetts, pp. 55–82.</p>
<p>García, J., & Traulsen, A. (2019). Evolution of coordinated punishment to enforce cooperation from an unbiased strategy space. Journal of the Royal Society Interface, 16(156), 20190127.</p>
<p>Güth, W. and Kliemt, H. (1998). The indirect evolutionary approach: Bridging the gap between rationality and adaptation, Rationality and Society 10(3): 377–399.</p>
<p>Hagen, E. H. and Hammerstein, P. (2006). Game theory and human evolution: A critique of some recent interpretations of experimental games, Theoretical Population Biology 69(3): 339–348.</p>
<p>Haley, K. J. and Fessler, D. M. (2005). Nobody’s watching?: Subtle cues affect generosity in an anonymous economic game, Evolution and Human behavior 26(3): 245–256.</p>
<p>Haselton, M. G., Nettle, D. and Murray, D. R. (2015). The evolution of cognitive bias, in D. Buss (ed.), The handbook of evolutionary psychology, Wiley Online Library, Hoboken, NJ, pp. 1–20. URL: https://onlinelibrary.wiley.com/doi/full/10.1002/9781119125563.evpsych241</p>
<p>Heintz, C. (2005). The ecological rationality of strategic cognition, Behavioral and Brain Sci- ences 28(6): 825–826.</p>
<p>Henrich, J., Boyd, R., Bowles, S., Camerer, C., Fehr, E., Gintis, H., McElreath, R., Alvard, M., Barr, A., Ensminger, J., Henrich, N. S., Hill, K., Gil-White, F., Gurven, M., Marlowe, F. W., Patton, J. Q. and Tracer, D. (2005). “economic man” in cross-cultural perspective: Behavioral experiments in 15 small-scale societies, Behavioral and Brain Sciences 28(6): 795–815.</p>
<p>Hill, K. R., Walker, R. S., Božičević, M., Eder, J., Headland, T., Hewlett, B., Hurtado, A. M., Marlowe, F., Wiessner, P. and Wood, B. (2011). Co-residence patterns in hunter-gatherer societies show unique human social structure, Science 331(6022): 1286–1289.</p>
<p>Hsu, L.-C. (2003). Effects of framing, group size, and the contribution mechanism on cooperation in threshold public goods and common resources experiments, Academia Economic Papers 31(1): 1–31.</p>
<p>Johnson, D. D., Stopka, P. and Knights, S. (2003). The puzzle of human cooperation, Nature 421(6926): 911–912.</p>
<p>Krebs, D. L. (2015). Prosocial behavior, in V. Zeigler-Hill, L. L. M. Welling and T. K. Shackelford (eds), Evolutionary perspectives on social psychology, Springer, Switzerland, pp. 231–242.</p>
<p>Ledyard, J. O. (1995). Public goods: A survey of experimental research, in J. Kagel and A. Roth (eds), Handbook of Experimental Economics, Princeton University Press, Princeton, chapter 2, pp. 111-193.</p>
<p>Næss, M. W. (n.d.). From hunter-gatherers to nomadic pastoralists: forager bands do not tell the whole story of the evolution of human cooperation.</p>
<p>Nowak, M. A., Sasaki, A., Taylor, C. and Fudenberg, D. (2004). Emergence of cooperation and evolutionary stability in finite populations, Nature 428(6983): 646–650.</p>
<p>Offerman, T., Sonnemans, J. and Schram, A. (1996). Value orientations, expectations and voluntary contributions in public goods, The Economic Journal 106(437): 817–845</p>
<p>Ostrom, E. (2000). Collective action and the evolution of social norms. Journal of Economic Perspectives, 14(3), 137-158.</p>
<p>Phillips, T. (2015). Human altruism and cooperation explainable as adaptations to past environments no longer fully evident in the modern world, The Quarterly Review of Biology 90(3): 295–314.</p>
<p>Raihani, N. J. and Bshary, R. (2015). Why humans might help strangers, Frontiers in Behavioral Neuroscience 9: 39.</p>
<p>Rand, D. G. (2016). Cooperation, fast and slow: Meta-analytic evidence for a theory of social heuristics and self-interested deliberation, Psychological Science 27(9): 1192–1206.</p>
<p>Rand, D. G., Tarnita, C. E., Ohtsuki, H. and Nowak, M. A. (2013). Evolution of fairness in the one-shot anonymous ultimatum game, Proceedings of the National Academy of Sciences 110(7): 2581–2586.</p>
<p>Richerson, P. J. and Boyd, R. (1999). Complex societies, Human Nature 10(3): 253–289.</p>
<p>Rusch, H. (2013). What niche did human cooperativeness evolve in, Ethics and Politics 15(2): 82–100.</p>
<p>Rusch, H. (2018). Ancestral kinship patterns substantially reduce the negative effect of increasing group size on incentives for public goods provision, Journal of Economic Psychology 64: 105–115.</p>
<p>Rusch, H. and Luetge, C. (2016). Spillovers from coordination to cooperation: Evidence for the interdependence hypothesis?, Evolutionary Behavioral Sciences 10(4): 284.</p>
<p>Schmelz, M., Grueneisen, S., Kabalak, A., Jost, J. and Tomasello, M. (2017). Chimpanzees return favors at a personal cost, Proceedings of the National Academy of Sciences 114(28): 7462–7467.</p>
<p>Stephens, C. (2005). Strong reciprocity and the comparative method, Analyse & Kritik 27(1): 97–105.</p>
<p>Stone, V. E., Cosmides, L., Tooby, J., Kroll, N. and Knight, R. T. (2002). Selective impairment of reasoning about social exchange in a patient with bilateral limbic system damage, Proceedings of the National Academy of Sciences 99(17): 11531–11536.</p>
<p>Sugiyama, L. S., Tooby, J. and Cosmides, L. (2002). Cross-cultural evidence of cognitive adaptations for social exchange among the shiwiar of ecuadorian amazonia, Proceedings of the National Academy of Sciences 99(17): 11537–11542.</p>
<p>Taylor, P. D. (1992). Inclusive fitness in a homogeneous environment. Proceedings of the Royal Society B, 249(1326), 299-302.</p>
<p>Tooby, J. and Cosmides, L. (1992). The psychological foundations of culture, The adapted mind: Evolutionary psychology and the generation of culture 19.</p>
<p>West, S. A., Gardner, A., Shuker, D. M., Reynolds, T., Burton-Chellow, M., Sykes, E. M., Edward, M., Guinnee, M. A. and Griffin, A. S. (2006). Cooperation and the scale of competition in humans. Current Biology, 16(11), 1103-1106.</p>
<p>Yamagishi, T. and Mifune, N. (2008). Does shared group membership promote altruism? Fear, greed, and reputation, Rationality and Society 20(1): 5–30.</p>nadiahkristensenHumans often cooperate in experimental games even when it’s not the strategy that will win them the most money (Ledyard, 1995; Cadsby and Maynes, 1999). They do this in one-shot games, where there is no chance the other could punish them if they took advantage, and in games with anonymous strangers, for whom they have no material reason to care. We see this cooperative tendency typically in the initial rounds of experimental public goods games (e.g., Offerman et al. 1996), but also in real-world common-resource problems (Ostrom 2000). From a naive economic or Darwinian perspective, which expects humans to behave in a mostly rational and self-interested way, this behaviour is puzzling.Finding cell neighbours in an ISEA3H global grid in dggridR2021-09-29T01:44:54+00:002021-09-29T01:44:54+00:00https://nadiah.org/2021/09/29/find-cell-neighbours-isea3h<p>In order to model a spatially discretised process on the whole Earth,
we need a discrete global grid system (DGGS).
Ideally, the DGGS would divide the globe into a tessellation of some regular polygon,
analogous to a grid of squares on the plane,
where the grid resolution can be increased by further subdivision of the polygon.
Another desirable property would be to have equal-distant centres, such as a hexagonal grid,
so that the neighbourhood of a grid cell is well defined.
Unfortunately, it is not possible to tessellate a sphere with hexagons only,
and there are mathematical limits to e.g. the number of points that can be completely regularly distributed on a sphere.
As a consequence, finding the ‘best’ DGGS is a research area of its own.</p>
<p>The most popular approach to defining a DGGS is to start with a regular base polyhedron,
one of the platonic solids, and then partition its faces into a grid in a hierarchical fashion.
Then some method is needed for projecting that grid on the solid onto a spherical surface,
with the goal of preserving as far as possible the desirable properties of the grid,
such as the equal areas or regular angles and distances between centre points.
Because there are many possible options for each of the design choices (base polyhedron, its orientation, grid shape, etc.),
there are quite a number of different DGGS available, each with their own strengths and weaknesses (Sahr et al., 2003).
Therefore, I decided to work with the most popular DGGS available,
as it will probably be the DGGS that offers the best compromise between desirable properties,
and it will have the most software and support available for it.</p>
<p>The Icosahedral Snyder Equal Area Aperture 3 Hexagonal Grid, or ISEA3H (Fig. 1)
appears to be the most popular DGGS (Mocnik, 2019).
Its base polyhedron is the icosahedron,
with its triangular faces partitioned into hexagons.
Because each vertex of the icosahedron is the meeting of 5 triangles,
the grid shape at each vertex is necessarily a pentagon.
Therefore the grid contains 12 pentagons in total, regardless of the grid resolution,
with area 5/6 the area of the hexagons.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/ISEA3H.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/ISEA3H.png" alt="Figure 1. The ISEA3H global grid at resolutions 2 (red), 3 (green), and 4 (purple), taken from Sahr et al. (2003)." />
</a>
<figcaption><span>Figure 1. The ISEA3H global grid at resolutions 2 (red), 3 (green), and 4 (purple), taken from Sahr et al. (2003).</span></figcaption>
</figure>
<p>‘Aperture 3’ refers to the way in which refinements of the hexagons are performed,
with the area of each hexagon decreasing by 1/3 at each increasing resolution (Fig. 2).
Aperture 3 is preferred because it is lower than the (only?) alternative, aperture 4.
In aperture 3, the refinements of the grid at each resolution cause the hexagons
to alternate between two orientations: point at top and edge at top.
Consequently,
for each even-numbered resolution (e.g. resolution 2, blue)
the triangle edge runs through the hexagon centres (‘Class I’),
whereas for each odd-numbered resolution (e.g. resolution 3, red) the triangle edge alternates between
being aligned with a centre or an edge of a hexagon cell (‘Class II’).
This creates complications for an axes-based indexing scheme (below).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/three_resolutions_aperture_3.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/three_resolutions_aperture_3.png" alt="Figure 2. Three resolutions of an aperture 3 hexagon grid on a triangular face of a base polyhedron (e.g. one triangular face of an icosahedron). Notice that the orientation of the hexagons alternates at each resolution. Adapted from Sahr et al. (2003)." />
</a>
<figcaption><span>Figure 2. Three resolutions of an aperture 3 hexagon grid on a triangular face of a base polyhedron (e.g. one triangular face of an icosahedron). Notice that the orientation of the hexagons alternates at each resolution. Adapted from Sahr et al. (2003).</span></figcaption>
</figure>
<p>The Inverse Snyder Equal-Area Projection is used to project the grid onto the Earth’s surface,
which is a general method projecting a platonic solid onto a sphere
such that the projected polygons are equal-area while the angles and distances are slightly distorted
(Snyder (1992) cited in Mocnik (2019)).
The algorithm appears to be quite involved,
and so I will need to rely upon existing software to implement it and create the ISEA3H grid itself.</p>
<p>One aspect that is often important for modelling
is a method for rapidly identifying the neighbourhoods of a given cell (e.g., if modelling dispersal).
Grid cells in a DGGS can be indexed in a number of ways, e.g. cells can be identified hierarchically
with respect to their ‘parent’ cells at each previous resolution.
While hierarchical techniques seem to be the most popular because they allow for efficient storage and retrieval,
axes-based techniques are the most efficient for finding cell neighbourhoods (Mahdavi-Amiri, Samavati and Peterson, 2015).
However, one difficulty is finding cell neighbourhoods that cross an edge of the underlying icosahedron.</p>
<h2>Default indexing options in DGGRID software</h2>
<p>By default, indexing of the grid in dggridR is by a sequence of integers 1 to the maximum number of cells.
However, it is possible to obtain the ‘Q2DI’ indexing scheme.
I couldn’t find documentation for the scheme,
but it appears to be a triplet identifying the cell’s:
(1) ‘diamond’ from the icosahedron net,
and (2,3) position within the diamond resulting from the two natural axes centred on the leftmost pentagon of the diamond
(e.g., Fig. 3).
This indexing scheme seems similar to the Mahdavi-Amiri, Harrison and Samavati (2015) scheme (below).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/Q2DI.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/Q2DI.png" alt="Figure 3. The resolution 2 ISEA3H with the Q2DI indexing scheme that comes built into dggridR. The opaque arrows represent the natural axes of diamond 8 in the scheme, so that each cell is indexed as: diamond number, up axis, down axis." />
</a>
<figcaption><span>Figure 3. The resolution 2 ISEA3H with the Q2DI indexing scheme that comes built into dggridR. The opaque arrows represent the natural axes of diamond 8 in the scheme, so that each cell is indexed as: diamond number, up axis, down axis.</span></figcaption>
</figure>
<h3>The Mahdavi-Amiri, Harrison and Samavati (2015) scheme</h3>
<p>Axes-based indexing schemes are the most convenient for identifying cell neighbourhoods.
Mahdavi-Amiri et al. (2015) devised an indexing scheme similar to the Q2DI above,
which involves dividing the icosahedron into 10 diamonds made of up-down pairs of triangle faces,
and then defining the position of each hexagonal cell within the diamond with respect to the natural
axes centred on the leftmost cell (Fig. 4).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/Mahdavi_diamonds.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/Mahdavi_diamonds.png" alt="Figure 4. An icosahedron (a), the icosahedron net divided into diamond faces (b), and a resolution 2 (Class I) hexagon partitioning with the axes superimposed (c). Adapted from Mahdavi-Amiri et al. (2015)." />
</a>
<figcaption><span>Figure 4. An icosahedron (a), the icosahedron net divided into diamond faces (b), and a resolution 2 (Class I) hexagon partitioning with the axes superimposed (c). Adapted from Mahdavi-Amiri et al. (2015).</span></figcaption>
</figure>
<p>The neighbourhood of a cell within a diamond is easily found in the
Mahdavi-Amiri et al. (2015) scheme,
and their Figure 14 and Table 5 provide rules for neighbourhoods that cross a diamond edge
(though I believe I might have found two errors in their Table 5; see Fig. 5).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/Fix_Mahdavi.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/Fix_Mahdavi.png" alt="Figure 5. Possible errors in Table 5." />
</a>
<figcaption><span>Figure 5. Possible errors in Table 5.</span></figcaption>
</figure>
<p>I partially implemented code to translate the Q2DI indices into Mahdavi-Amiri et al. (2015) indices
and find cell neighbourhoods for even-resolution (Class I) grids.
The code was a bit cumbersome and required a lot of case checking.
For example, the pentagons at the north and south poles of the grid are their own special case.
So I decided to check the literature for other ideas.</p>
<h2>Vince (2006) scheme</h2>
<p>Vince (2006) described an elegant scheme for indexing octahedral aperture 3 hexagonal grid (OA3H).
The octahedron has the convenient property that its 6 vertices can be aligned with the three axes of the
3-dimensional Cartesian space.
Then the barycentres of cells at resolution \(r\) can be given by two equations in Proposition 1,
depending upon whether the resolution number is even (Class I orientation) or odd (Class II orientation, Fig. 2),
which can be simplified as a triple of integers called the A3-coordinates \((a,b,c)\).</p>
<p>Proposition 3 in Vince (2006) gives the method of calculating the set of 6 neighbours for every cell,
with a sign-changing rule if the neighbouring cell is on a different octahedral face.
I think I found a missing rule for the Class II case,
so I will rewrite the explanation of the proposition with my correction below.</p>
<p>The six neighbours of a hexagonal cell \((a,b,c)\) can be listed:</p>
<ul>
<li>If \(r\) is even:
<ol>
<li>\((a+1, b-1, c)\).</li>
<li>\((a-1, b+1, c)\).</li>
<li>\((a+1, b, c-1)\).</li>
<li>\((a-1, b, c+1)\).</li>
<li>\((a, b+1, c-1)\).</li>
<li>\((a, b-1, c-1)\).</li>
</ol>
</li>
<li>If \(r\) is odd:
<ol>
<li>\((a+2, b-1, c-1)\).</li>
<li>\((a-2, b+1, c+1)\).</li>
<li>\((a-1, b+2, c-1)\).</li>
<li>\((a+1, b-2, c+1)\).</li>
<li>\((a-1, b-1, c+2)\).</li>
<li>\((a+1, b+1, c-2)\).</li>
</ol>
</li>
</ul>
<p>The \(\pm\)’s in the above formula are to be understood subject to the following conventions.
If the number \(a, b,\) or \(c\) is negative, then the sign of the operation changes.
If something is subtracted from 0, then the signs of the other operations change.
If \(r\) is odd and a subtraction from a positive number results in a negative,
then none of the operations are performed except the sign-changing one.</p>
<p>Using three axes coordinates seems inefficient compared to the
Mahdavi-Amiri et al. (2015) scheme above,
however the rules for edge-crossing neighbourhoods are simpler,
and there are no special-case cells (e.g. the north and south pole pentagons).</p>
<h2>An indexing scheme for ISEA3H based on Vince (2006)</h2>
<h3>Indexing the vertices of the icosahedron</h3>
<p>Vince (2006) states that, although they only applied their indexing method for the octahedron,
the same method can be applied to other triangular-faced polyhedra including the icosahedron.</p>
<p>When the base polyhedron is an octahedron,
because the 6 vertices of the octahedron can be mapped to each of the 6 positive
and negative axes of a 3-dimensional Cartesian space,
then an edge crossing involves a simple flip of the sign of one of the axes.
The icosahedron has 6 natural axes, suggesting a 6-dimensional space, so the first thing I tried was to interpret the indices in relation to 6D Cartesian coordinates.
I was able to find a way to project a 6-dimensional hypercube into 3-dimensional space to produce an icosahedron;
however, I wasn’t able to find a simple indexing scheme that took advantage of this projection.</p>
<p>The second thing I tried was to treat each vertex of the icosahedron as an axes in a scheme similar to Vince (2006).
The triangular faces of the icosahedron are analogous to the triangular faces of the octahedron in each Cartesian quadrant,
so this would preserve the Vince (2006) for neighbourhoods within the face.</p>
<p>The question then is how to index the 12 vertices,
and in a way that makes the calculation of the new face after an edge crossing as simple as possible.
There are 30 edges of an icosahedron,
so it would not be expensive to simply list every pair of faces corresponding to each edge crossing.
However, I wondered if there was a tidy way in which the edge crossings could be calculated.</p>
<p>Based on the gut feeling that vertex indexing scheme should be as ‘regular’ as possible,
I chose the indexing scheme in Fig. 6.
It is the Hamiltonian (circuit of the icosahedron’s graph) that gives the highest degree of symmetry.
As a consequence, the adjacency graph has a regular pattern,
with only two ‘types’ of vertex – odd and even corresponding to inner and outer vertices in the figure –
such that adjacency follows the same pattern within each type.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/icosahedron_numbering.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/icosahedron_numbering.png" alt="Figure 6. An indexing of vertices that produces good properties (see text). Opposite poles are always 6 apart in mod 12. The vertices can be split into two alternating types, 'outer' or 'inner', with indices that are even or odd, respectively. Then the 5 vertices adjacent to a focal vertex are always the same distances from the focal vertex (in mod 12), depending only on whether the focal vertex is odd or even." />
</a>
<figcaption><span>Figure 6. An indexing of vertices that produces good properties (see text). Opposite poles are always 6 apart in mod 12. The vertices can be split into two alternating types, 'outer' or 'inner', with indices that are even or odd, respectively. Then the 5 vertices adjacent to a focal vertex are always the same distances from the focal vertex (in mod 12), depending only on whether the focal vertex is odd or even.</span></figcaption>
</figure>
<p>When I use indexing scheme in Fig. 6,
the <em>opposite pole</em> of a vertex \(v\) is simply</p>
\[P(v) = (v + 6) \text{ mod } 12.\]
<p>For example, the opposite pole of \(v=10\) is</p>
\[P(v=10) = (10+6) \text{ mod } 12 = 16 \text{ mod } 12 = 4.\]
<p>The indexing scheme in Fig. 6 also permits us to define vertex adjacency in a tidy way.
The vertices adjacent to \(v\) can be put into an ordered list</p>
\[\mathbf{n}_v = (v + \mathbf{s}_v) \text{ mod } 12,\]
<p>where the subscript \(v\) in \(\mathbf{s}_v\) is understood to be in mod 2,
and where \(\mathbf{s}_0\) and \(\mathbf{s}_1\) are the ordered lists of distances away from vertex \(v\)</p>
\[\begin{align}
\mathbf{s}_{0} &= [10, 1, 2, 3, 11], \\
\mathbf{s}_{1} &= [1, 4, 8, 9, 11].
\end{align}\]
<p>The ordering represents clockwise circuit around \(v\) in Fig. 6.
For example, the vertices adjacent to vertex 3 are</p>
\[\begin{align}
\mathbf{n}_3
&= [3+1, 3+4, 3+8, 3+9, 3+11] \text{ mod } 12, \nonumber \\
&= [4, 7, 11, 12, 13] \text{ mod } 12, \nonumber \\
&= [4, 7, 11, 0, 2]. \nonumber
\end{align}\]
<p>As another example,
the vertices adjacent to vertex 10 are</p>
\[\begin{align}
\mathbf{n}_{10}
&= [10+10, 10+1, 10+2, 10+3, 10+11] \text{ mod } 12, \nonumber \\
&= [8, 11, 0, 1, 9]. \nonumber
\end{align}\]
<p>We can also label an adjacent vertex in terms of its index in \(\mathbf{n}_v\).
In the example above where vertex \(v=3\) is the focal vertex,
its adjacent vertex 4 has index \(I_3(4) = 0\),
so we say \(\mathbf{n}_3(0) = 4\).</p>
<p>For brevity below,
the indices are understood to be in mod 5,
i.e. \(\mathbf{n}_v(i) \rightarrow \mathbf{n}_v(i \text{ mod } 5)\),
and the input into the index function is understood to be in mod 12, i.e.
i.e. \(I_v(x) \rightarrow I_v(x \text{ mod } 12)\).</p>
<h3>Two ways to cross an edge</h3>
<p>An edge crossing is a movement from one face of the icosahedron over an edge to an adjacent face
(e.g. Fig. 7).
Define a <em>face</em> \(F\) by the triple of vertices \(F=\lbrace x, y, z \rbrace\).
An adjacent face \(F' = \lbrace x', y, z \rbrace\)
shares one edge with the original face
\(E = \lbrace y,z \rbrace\),
and it has a new vertex \(x'\) replacing \(x\).</p>
<p>I’ll call \(x'\) the opposite vertex of \(x\) with respect to edge \(E=\lbrace y,z \rbrace\).
So we want a function</p>
\[\omega(x, \lbrace y, z \rbrace ) = x'\]
<h4>Method 1</h4>
<p>One way we can identify the pair \(x\) and \(x'\) from the edge \(E = \lbrace y,z \rbrace\)
by taking advantage of the ordering scheme above:
we know that \(x\) and \(x'\) are one step away from \(z\) in \(\mathbf{n}_y\).
First we identify the index corresponding to \(z\) in \(\mathbf{n}_y\),
\(I_y(z)\),
then the opposite vertex pair can be found</p>
\[\begin{align}
x & = n_y(I_y(z) + 1), \nonumber \\
x' & = n_y(I_y(z) - 1).
\end{align}\]
<p>So one way to define \(\omega\) is</p>
\[\begin{equation}
\omega(x, \lbrace y, z \rbrace ) = n_y(I_y(z) \pm 1),
\label{easier_omega}
\end{equation}\]
<p>where we choose the returned value that is not \(x\).</p>
<p>For example,
consider the edge \(E = \lbrace 7, 11 \rbrace\) in Fig. 7.
Let \(y=7\) and \(z=11\),
then \(\mathbf{n}_y = \mathbf{n}_7 = [8, 11, 3, 4, 6]\),
and \(I_y(z) = I_7(11) = 1\).
Therefore \(x = n_y(I_y(z)+1) = n_7(2) = 3\) and
\(x' = n_y(I_y(z)-1) = n_7(0) = 8\).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/icosahedron_opposite_vertices.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/icosahedron_opposite_vertices.png" alt="Figure 7. An example of method 1." />
</a>
<figcaption><span>Figure 7. An example of method 1.</span></figcaption>
</figure>
<h4>Method 2</h4>
<p>Another way to find \(x'\) is to observe that it is the opposite pole of the vertex \(w\),
where \(w\) is 2 ‘steps away’ from a vertex of the shared edge
(Fig. 8).
To formalise what is meant by 2 ‘steps away’,
I can take advantage of the fact that \(\mathbf{n}_x\) describes a clockwise circuit around the vertex \(x\).
The clockwise ordering scheme therefore permits us to identify a direction and a ‘maximal’ vertex of an edge pair with respect to a central vertex.
In the example above, where vertex 3 is the central vertex,
then the edge \(E = \lbrace 11,0 \rbrace\) has maximal element \(\text{max}( \lbrace 11, 0 \rbrace_3) = 0\).
Similarly, \(\text{max}(\lbrace 9, 8 \rbrace_{10}) = 8\).
We can therefore define the maximal index of an edge \(\hat{I}_v(E) = I(\text{max}(E_v))\).
Then the new vertex \(x'\) can be found</p>
\[\omega(x,E) = P(w), \text{ where } w = \mathbf{n}_x \left( \hat{I}_x(E) + 2 \right). \label{harder_omega}\]
<p>For example, consider the edge-crossing shown in Fig. 8.
The original face is the face in blue,
\(F = \lbrace 3, 7, 11 \rbrace\).
The edge crossed is \(E = \lbrace 7, 11 \rbrace\).
The vertex 11 is maximal in the clockwise direction,
and counting 2 steps away from vertex 11 gives \(w = 2\).
The opposite pole of \(w=2\) is \(x' = 8\).
Therefore the adjacent face is \(F' = \lbrace 8, 7, 11 \rbrace\).</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/icosahedron_edge_crossing.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/icosahedron_edge_crossing.png" alt="Figure 8. An example of method 2." />
</a>
<figcaption><span>Figure 8. An example of method 2.</span></figcaption>
</figure>
<h3>Cell neighbourhood rules</h3>
<p>The cell index can be encoded as a list of up to 6 digits,
where the first one to three digits identify the face on the icosahedron where the cell resides,
and the last three digits identify its axis location according the scheme of
Vince (2006)</p>
\[c = [ v_i, v_j, v_k, h_i, h_j, h_k ],\]
<p>where the maximum \(h\) index value</p>
\[\hat{h} = 3^{ \lfloor \frac{r+1}{2} \rfloor }.\]
<p>If the cell is on a vertex of the icosahedron, then it is one of the 12 pentagon cells.
Only 1 digit of the vertex is needed to identify it, i.e.</p>
\[c = [ v_i, -, -, \hat{h}, 0, 0 ] \text{ is a pentagon}.\]
<p>If the cell is on an edge of the icosahedron, then the two icosahedron vertices of that edge are needed, i.e.</p>
\[c = [ v_i, v_j, -, h_i, h_j, 0 ] \text{ is a hexagonal cell on an icosahedron edge}.\]
<p>For cells in the interior of the face, all three icosahedron vertices are needed.
If the vertices defining the icosahedral edge or face are always in ascending order,
then each cell has a unique index.</p>
<p>For a focal hexagonal cell \(c = (v_i, v_j, v_k, h_i, h_j, h_k)\),
the neighbouring cells \(c' = (v_i', v_j', v_k', h_i', h_j', h_k')\) can be found with similar rules to before:</p>
<ul>
<li>if \(r\) is even:
<ol>
<li>\((h_i+1, h_j-1, h_k)\).</li>
<li>\((h_i-1, h_j+1, h_k)\).</li>
<li>\((h_i+1, h_j, h_k-1)\).</li>
<li>\((h_i-1, h_j, h_k+1)\).</li>
<li>\((h_i, h_j+1, h_k-1)\).</li>
<li>\((h_i, h_j-1, h_k-1)\).</li>
</ol>
</li>
<li>if \(r\) is odd:
<ol>
<li>\((h_i+2, h_j-1, h_k-1)\).</li>
<li>\((h_i-2, h_j+1, h_k+1)\).</li>
<li>\((h_i-1, h_j+2, h_k-1)\).</li>
<li>\((h_i+1, h_j-2, h_k+1)\).</li>
<li>\((h_i-1, h_j-1, h_k+2)\).</li>
<li>\((h_i+1, h_j+1, h_k-2)\).</li>
</ol>
</li>
</ul>
<p>The additional rules are needed to handle edge-crossing:</p>
<ul>
<li>If something is subtracted from \(h_k = 0\) so \(h'_k < 0\), then:
<ul>
<li>\(v_k' = \omega(v_k, (v_i,v_j) )\).</li>
<li>the sign of \(h'_k\) is swapped;</li>
<li>the signs of the other operations are swapped and \(h_i'\) and \(h_j'\) recalculated</li>
</ul>
</li>
<li>If something is subtracted from \(h_k \neq 0\) so \(h'_k < 0\), then:
<ul>
<li>\(v_k' = \omega(v_k, (v_i,v_j) )\).</li>
<li>the new hexagon indices are the same as the old, i.e. \((h_i', h_j', h_k') = (h_i, h_j, h_k)\)</li>
</ul>
</li>
</ul>
<p>For a focal pentagonal cell \(c = (v_i, -, -, \hat{h}, 0, 0)\),</p>
<ul>
<li>if \(r\) is even then \(c' = (v_i, \mathbf{n}_{v_i}(x), -, \hat{h}-1, 1, 0)\) for \(x = 0, \ldots, 4\).</li>
<li>else if \(r\) is odd then \(c' = (v_i, \mathbf{n}_{v_i}(x), \mathbf{n}_{v_i}(x+1), \hat{h}-2, 1, 1)\) for \(x = 0, \ldots, 4\).</li>
</ul>
<h3>Implementation</h3>
<p>I’ve put <a href="https://github.com/nadiahpk/cell_neighbours_isea3h_vince">some code on Github</a>.
In order to run it, you’ll need both rgdal and dggridR.
The dggridR package has since been removed from CRAN, so you will need to install from the archive.</p>
<p>First, install the prerequisite packages, on the commandline:</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span><span class="nb">sudo </span>apt-get <span class="nb">install </span>r-cran-rgdal
<span class="nv">$ </span><span class="nb">sudo </span>apt-get <span class="nb">install </span>r-cran-devtools</code></pre></figure>
<p>To install dggridR from the archive, in R:</p>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="o">></span><span class="w"> </span><span class="n">library</span><span class="p">(</span><span class="s1">'devtools'</span><span class="p">)</span><span class="w">
</span><span class="n">Loading</span><span class="w"> </span><span class="n">required</span><span class="w"> </span><span class="n">package</span><span class="o">:</span><span class="w"> </span><span class="n">usethis</span><span class="w">
</span><span class="o">></span><span class="w"> </span><span class="n">install_url</span><span class="p">(</span><span class="s1">'https://cran.r-project.org/src/contrib/Archive/dggridR/dggridR_2.0.4.tar.gz'</span><span class="p">)</span><span class="w">
</span><span class="c1"># Chose Update All when prompted</span></code></pre></figure>
<p>Then to run the <a href="https://github.com/nadiahpk/cell_neighbours_isea3h_vince">code I put on Github</a>,
in R:</p>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="o">></span><span class="w"> </span><span class="n">library</span><span class="p">(</span><span class="n">dplyr</span><span class="p">)</span><span class="w">
</span><span class="o">></span><span class="w"> </span><span class="n">library</span><span class="p">(</span><span class="n">dggridR</span><span class="p">)</span><span class="w">
</span><span class="o">></span><span class="w"> </span><span class="n">source</span><span class="p">(</span><span class="s2">"Q2DI_to_V.R"</span><span class="p">)</span><span class="w">
</span><span class="o">></span><span class="w"> </span><span class="n">source</span><span class="p">(</span><span class="s2">"get_V_label.R"</span><span class="p">)</span><span class="w">
</span><span class="o">></span><span class="w"> </span><span class="n">source</span><span class="p">(</span><span class="s1">'find_neighbours_V.R'</span><span class="p">)</span><span class="w">
</span><span class="o">></span><span class="w"> </span><span class="n">source</span><span class="p">(</span><span class="s1">'plot_vince_wneighs.R'</span><span class="p">)</span><span class="w">
</span><span class="o">></span><span class="w"> </span><span class="n">plot_vince</span><span class="p">(</span><span class="m">3</span><span class="p">)</span><span class="w"> </span><span class="c1"># 3 refers to a resolution 3 grid</span></code></pre></figure>
<p>This should produce a pdf that looks like Fig. 9.</p>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/res_3_vince.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/res_3_vince.png" alt="Figure 9. Running the snippet of code above should produce this figure. Each cell is labelled according to the new indexing scheme. I've also chosen five cells and found their neighbourhoods, highlighted in red." />
</a>
<figcaption><span>Figure 9. Running the snippet of code above should produce this figure. Each cell is labelled according to the new indexing scheme. I've also chosen five cells and found their neighbourhoods, highlighted in red.</span></figcaption>
</figure>
<p>To run it for different resolution, just change the variable:</p>
<figure class="highlight"><pre><code class="language-r" data-lang="r"><span class="o">></span><span class="w"> </span><span class="n">plot_vince</span><span class="p">(</span><span class="m">4</span><span class="p">)</span><span class="w"> </span><span class="c1"># 4 refers to a resolution 4 grid</span></code></pre></figure>
<figure style="max-width: 700px; margin: auto; padding-bottom: 20px;">
<a href="/wp-content/uploads/2021/09/res_4_vince.png">
<img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2021/09/res_4_vince.png" alt="Figure 10. Running the snippet of code above should produce this figure." />
</a>
<figcaption><span>Figure 10. Running the snippet of code above should produce this figure.</span></figcaption>
</figure>
<p>The code is no way optimised (more a proof of concept), so resolution 4 is about as far as I would go.</p>
<h2>References</h2>
<p>Barnes, R. (2017). dggridR: Discrete Global Grids for R. R package version 0.1.12. URL: <a href="https://github.com/r-barnes/dggridR/">https://github.com/r-barnes/dggridR/</a></p>
<p>Mahdavi-Amiri, A., Harrison, E. and Samavati, F. (2015). Hexagonal connectivity maps for digital earth, International Journal of Digital Earth 8(9): 750–769.</p>
<p>Mahdavi-Amiri, A., Samavati, F. and Peterson, P. (2015). Categorization and conversions for indexing methods of discrete global grid systems, ISPRS International Journal of GeoInformation 4(1): 320–336.</p>
<p>Mocnik, F.-B. (2019). A novel identifier scheme for the isea aperture 3 hexagon discrete global grid system, Cartography and Geographic Information Science 46(3): 277–291.</p>
<p>Sahr, K. (2018). DGGRID version 6.4: User documentation for discrete global grid software, Southern Terra Cognita Laboratory. URL: https://discreteglobalgrids.org/wp-content/uploads/2019/05/dggridManualV64.pdf</p>
<p>Sahr, K., White, D. and Kimerling, A. J. (2003). Geodesic discrete global grid systems, Cartography and Geographic Information Science 30(2): 121–134.</p>
<p>Vince, A. (2006). Indexing the aperture 3 hexagonal discrete global grid, Journal of Visual Communication and Image Representation 17(6): 1227–1236.</p>nadiahkristensenIn order to model a spatially discretised process on the whole Earth, we need a discrete global grid system (DGGS). Ideally, the DGGS would divide the globe into a tessellation of some regular polygon, analogous to a grid of squares on the plane, where the grid resolution can be increased by further subdivision of the polygon. Another desirable property would be to have equal-distant centres, such as a hexagonal grid, so that the neighbourhood of a grid cell is well defined. Unfortunately, it is not possible to tessellate a sphere with hexagons only, and there are mathematical limits to e.g. the number of points that can be completely regularly distributed on a sphere. As a consequence, finding the ‘best’ DGGS is a research area of its own.