Jekyll2022-12-06T05:12:07+00:00https://nadiah.org/feed.xmlNadiah Pardede KristensenExample numerical analysis of replicator dynamics with more than 2 strategies2022-11-29T04:44:54+00:002022-11-29T04:44:54+00:00https://nadiah.org/2022/11/29/replicator-numerical<p>Recently, I set a task for a student to use Python to analyse the replicator dynamics of a game with three strategies, including using the Jacobian to determine the stability of the steady state. The purpose of this blog post is to share the solution in case that’s useful to someone.</p> <h3>The game</h3> <p>For this task, we will consider the replicator dynamics of a 2-player game with 3 strategies.</p> <p>Recall the general equation for the replicator dynamics is</p> $\begin{equation} \dot{p}_i = p_i (f_i - \bar{f}) \end{equation}$ <p>where $$p_i$$ is proportion of $$i$$-strategists in the population, $$f_i$$ is fitness effect of strategy $$i$$, and $$\bar{f}$$ is the average fitness in the population.</p> <p>The fitness effect is the expected payoff</p> $\begin{equation} f_i = \sum_j p_j \pi(i \mid j) \end{equation}$ <p>where $$\pi(i \mid j)$$ is the payoff to an $$i$$-strategist who has been paired against a $$j$$-strategist. The average fitness</p> $\begin{equation} \bar{f} = \sum_j f_j p_j. \end{equation}$ <p>For this example, the payoffs are given by the matrix</p> $\begin{equation} \pi = \begin{pmatrix} 0 &amp; 1 &amp; 4 \\ 1 &amp; 4 &amp; 0 \\ -1 &amp; 6 &amp; 2 \\ \end{pmatrix}, \end{equation}$ <p>where $$\pi(i \mid j)$$ is given by element $$\pi_{i,j}$$. For example, when strategy 1 plays against strategy 2, strategy 1 receives payoff 1; when strategy 1 plays against strategy 3, strategy 1 receives payoff 4; and so on. This example is taken from Ohtsuki <em>et. al.</em> (2006).</p> <h3>Plot the dynamics</h3> <p>To gain an intuition for the dynamics, we will first plot them.</p> <p><a href="http://web.evolbio.mpg.de/~boettcher//other/2016/egtsimplex.html">Marvin Böttcher</a> has written a handy utility for plotting the dynamics of a 3-strategy game on a simplex called <strong>egtsimplex</strong>. It can be downloaded from the Github repository here: <a href="https://github.com/marvinboe/egtsimplex">https://github.com/marvinboe/egtsimplex</a>. The repository includes an example that we can look at to see how it works.</p> <p>First, we need to create a function that defines the dynamics and returns $$\dot{\boldsymbol{p}}$$.</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="k">def</span> <span class="nf">calc_dotps</span><span class="p">(</span><span class="n">pis</span><span class="p">,</span> <span class="n">t</span><span class="p">):</span> <span class="c1"># matrix of payoffs between R1, R2, and R3 </span> <span class="n">payoffs</span> <span class="o">=</span> <span class="p">[</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">4</span><span class="p">],</span> <span class="p">[</span> <span class="mi">1</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="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span> <span class="p">]</span> <span class="c1"># replicator dynamics: \dot{p}_i = p_i (f_i - \bar{f}) </span> <span class="c1"># where p_i is proportion of i in the population </span> <span class="c1"># f_i is fitness effect of strategy i </span> <span class="c1"># f_i = \sum_j p_j pay(i|j) where pay(i|j) is the payoff to i playing against j </span> <span class="c1"># \bar{f} is the average fitness in the population </span> <span class="c1"># \bar{f} = \sum_j f_j p_j </span> <span class="c1"># calculate the fitness of each strategy in the population </span> <span class="n">fis</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span> <span class="n">fi</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span> <span class="n">fi</span> <span class="o">+=</span> <span class="n">payoffs</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span><span class="o">*</span><span class="n">pis</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="n">fis</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">fi</span><span class="p">)</span> <span class="c1"># average fitness in the population </span> <span class="n">fbar</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span><span class="n">fis</span><span class="p">[</span><span class="n">j</span><span class="p">]</span><span class="o">*</span><span class="n">pis</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span> <span class="c1"># calculate the derivatives </span> <span class="n">dotps</span> <span class="o">=</span> <span class="p">[</span><span class="n">pis</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">*</span><span class="p">(</span><span class="n">fis</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">-</span><span class="n">fbar</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">)]</span> <span class="k">return</span> <span class="n">dotps</span></code></pre></figure> <p>Above, I chose to define each fitness effect in a for-loop to be as explict as possible about the connection to the equations above.</p> <p>To plot the dynamics, we create a <code class="language-plaintext highlighter-rouge">simplex_dynamics</code> object called <code class="language-plaintext highlighter-rouge">dynamics</code>, and use the method <code class="language-plaintext highlighter-rouge">plot_simplex()</code>:</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">import</span> <span class="nn">egtsimplex</span> <span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="n">plt</span> <span class="n">dynamics</span> <span class="o">=</span> <span class="n">egtsimplex</span><span class="p">.</span><span class="n">simplex_dynamics</span><span class="p">(</span><span class="n">calc_dotps</span><span class="p">)</span> <span class="n">fig</span><span class="p">,</span><span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="p">.</span><span class="n">subplots</span><span class="p">()</span> <span class="n">dynamics</span><span class="p">.</span><span class="n">plot_simplex</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">typelabels</span><span class="o">=</span><span class="p">[</span><span class="s">'R1'</span><span class="p">,</span> <span class="s">'R2'</span><span class="p">,</span> <span class="s">'R3'</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>That produces a nice graph like the one below.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/plot_dynamics.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/plot_dynamics.png" alt="Replicator dynamics on the simplex produced using egtsimplex by Marvin Böttcher" /> </a> <figcaption><span>Replicator dynamics on the simplex produced using egtsimplex by Marvin Böttcher</span></figcaption> </figure> <p>In the process of finding the dynamics, <strong>egtsimplex</strong> stored the fixed points it found…</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">fp_xy</span> <span class="o">=</span> <span class="n">dynamics</span><span class="p">.</span><span class="n">fixpoints</span> <span class="n">fp_xy</span> <span class="n">array</span><span class="p">([[</span> <span class="mf">1.00000000e+00</span><span class="p">,</span> <span class="o">-</span><span class="mf">6.69773909e-14</span><span class="p">],</span> <span class="p">[</span> <span class="mf">5.00000000e-01</span><span class="p">,</span> <span class="mf">8.66025404e-01</span><span class="p">],</span> <span class="p">[</span> <span class="mf">3.57142857e-01</span><span class="p">,</span> <span class="mf">2.47435830e-01</span><span class="p">],</span> <span class="p">[</span><span class="o">-</span><span class="mf">3.01051047e-13</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.99845407e-13</span><span class="p">],</span> <span class="p">[</span><span class="o">-</span><span class="mf">4.18950369e-15</span><span class="p">,</span> <span class="o">-</span><span class="mf">2.21083405e-15</span><span class="p">],</span> <span class="p">[</span> <span class="mf">5.76254503e-14</span><span class="p">,</span> <span class="mf">3.29021429e-14</span><span class="p">]])</span></code></pre></figure> <p>… however, these are in $$(x,y)$$ coordinates for plotting. To get the barycentric coordinates, i.e., the actual quanties of $$p_1$$, $$p_2$$, and $$p_3$$, we can use the <code class="language-plaintext highlighter-rouge">xy2ba()</code> method</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">fp_ba</span> <span class="o">=</span> <span class="p">[</span><span class="n">dynamics</span><span class="p">.</span><span class="n">xy2ba</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="ow">in</span> <span class="n">fp_xy</span><span class="p">]</span> <span class="n">fp_ba</span> <span class="p">[</span><span class="n">array</span><span class="p">([</span> <span class="mf">2.62163913e-14</span><span class="p">,</span> <span class="mf">1.00000000e+00</span><span class="p">,</span> <span class="o">-</span><span class="mf">7.72715225e-14</span><span class="p">]),</span> <span class="n">array</span><span class="p">([</span><span class="mf">3.31994121e-14</span><span class="p">,</span> <span class="mf">3.74364097e-18</span><span class="p">,</span> <span class="mf">1.00000000e+00</span><span class="p">]),</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.5</span> <span class="p">,</span> <span class="mf">0.21428571</span><span class="p">,</span> <span class="mf">0.28571429</span><span class="p">]),</span> <span class="n">array</span><span class="p">([</span> <span class="mf">1.00000000e+00</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.85694097e-13</span><span class="p">,</span> <span class="o">-</span><span class="mf">2.30639537e-13</span><span class="p">]),</span> <span class="n">array</span><span class="p">([</span> <span class="mf">1.00000000e+00</span><span class="p">,</span> <span class="o">-</span><span class="mf">2.94854279e-15</span><span class="p">,</span> <span class="o">-</span><span class="mf">2.60257234e-15</span><span class="p">]),</span> <span class="n">array</span><span class="p">([</span><span class="mf">1.0000000e+00</span><span class="p">,</span> <span class="mf">3.8651550e-14</span><span class="p">,</span> <span class="mf">3.8064861e-14</span><span class="p">])]</span></code></pre></figure> <p>The interior steady state is the 3rd one in <code class="language-plaintext highlighter-rouge">fp_ba</code> above. We can already tell from the plot there are oscillatory dynamics, but it’s not immediately obvious whether the interior steady state is an attractor, repellor, or neutral. Let’s try plotting a trajectory that starts nearby.</p> <p>To plot a trajectory, I’ll use <code class="language-plaintext highlighter-rouge">solve_ivp</code> with the <code class="language-plaintext highlighter-rouge">LSODA</code> method. I know that $$\sum_j p_j = 1$$, so I’ll write a lambda function that takes into account that constraint and reduce the number of state variables from 3 to 2.</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">from</span> <span class="nn">scipy.integrate</span> <span class="kn">import</span> <span class="n">solve_ivp</span> <span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span> <span class="c1"># a function that accepts t and the population proportions for the first # two variables and returns the dv/dt for the first two variables </span><span class="n">fnc</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">t</span><span class="p">,</span> <span class="n">p</span><span class="p">:</span> <span class="n">calc_dotps</span><span class="p">([</span><span class="n">p</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">p</span><span class="p">[</span><span class="mi">1</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="mi">0</span><span class="p">]</span><span class="o">-</span><span class="n">p</span><span class="p">[</span><span class="mi">1</span><span class="p">]],</span> <span class="n">t</span><span class="p">)[:</span><span class="mi">2</span><span class="p">]</span> <span class="c1"># numerically integrate the dynamics </span><span class="n">sol</span> <span class="o">=</span> <span class="n">solve_ivp</span><span class="p">(</span><span class="n">fnc</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">50</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">],</span> <span class="n">method</span><span class="o">=</span><span class="s">'LSODA'</span><span class="p">)</span> <span class="c1"># the solution is stored in y </span><span class="n">pt</span> <span class="o">=</span> <span class="n">sol</span><span class="p">.</span><span class="n">y</span><span class="p">.</span><span class="n">T</span> <span class="c1"># look at the first 10 points </span><span class="n">pt</span><span class="p">[:</span><span class="mi">10</span><span class="p">]</span> <span class="n">array</span><span class="p">([[</span><span class="mf">0.5</span> <span class="p">,</span> <span class="mf">0.2</span> <span class="p">],</span> <span class="p">[</span><span class="mf">0.5036369</span> <span class="p">,</span> <span class="mf">0.19880293</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.50716848</span><span class="p">,</span> <span class="mf">0.19788863</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.5138994</span> <span class="p">,</span> <span class="mf">0.196637</span> <span class="p">],</span> <span class="p">[</span><span class="mf">0.51973676</span><span class="p">,</span> <span class="mf">0.19656723</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.52426076</span><span class="p">,</span> <span class="mf">0.19769877</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.52731171</span><span class="p">,</span> <span class="mf">0.20026023</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.52808714</span><span class="p">,</span> <span class="mf">0.20405974</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.52646399</span><span class="p">,</span> <span class="mf">0.2088587</span> <span class="p">],</span> <span class="p">[</span><span class="mf">0.52363774</span><span class="p">,</span> <span class="mf">0.21300196</span><span class="p">]])</span></code></pre></figure> <p>To add the trajectory to the plot, we will need to revert <code class="language-plaintext highlighter-rouge">pt</code> above from a 2-dimensional to 3-dimensional system, and then convert the 3-dimensional barycentric coordinates to $$(x,y)$$ for plotting.</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">traj_xy</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span> <span class="k">for</span> <span class="n">p1</span><span class="p">,</span> <span class="n">p2</span> <span class="ow">in</span> <span class="n">pt</span><span class="p">:</span> <span class="n">p3</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">-</span> <span class="n">p1</span> <span class="o">-</span> <span class="n">p2</span> <span class="n">traj_xy</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">dynamics</span><span class="p">.</span><span class="n">ba2xy</span><span class="p">([</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">])))</span> <span class="n">traj_x</span><span class="p">,</span> <span class="n">traj_y</span> <span class="o">=</span> <span class="nb">zip</span><span class="p">(</span><span class="o">*</span><span class="n">traj_xy</span><span class="p">)</span> <span class="c1"># plot the simplex dynamics again and put the trajectory on top in red </span><span class="n">fig</span><span class="p">,</span><span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="p">.</span><span class="n">subplots</span><span class="p">()</span> <span class="n">dynamics</span><span class="p">.</span><span class="n">plot_simplex</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">typelabels</span><span class="o">=</span><span class="p">[</span><span class="s">'R1'</span><span class="p">,</span> <span class="s">'R2'</span><span class="p">,</span> <span class="s">'R3'</span><span class="p">])</span> <span class="n">ax</span><span class="p">.</span><span class="n">scatter</span><span class="p">([</span><span class="n">traj_x</span><span class="p">[</span><span class="mi">0</span><span class="p">]],</span> <span class="p">[</span><span class="n">traj_y</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">'red'</span><span class="p">)</span> <span class="n">ax</span><span class="p">.</span><span class="n">plot</span><span class="p">(</span><span class="n">traj_x</span><span class="p">,</span> <span class="n">traj_y</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">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span></code></pre></figure> <p>That produces the figure below, which suggests that the interior steady state is unstable.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/plot_dynamics_with_trajectory.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/plot_dynamics_with_trajectory.png" alt="A trajectory of the replicator dynamics (start point marked with dot)" /> </a> <figcaption><span>A trajectory of the replicator dynamics (start point marked with dot)</span></figcaption> </figure> <h3>Use the eigenvalues of the Jacobian matrix to assess the stability of the interior steady state</h3> <p>Ohtsuki <em>et al.</em> (2006) determined the eigenvalues of the Jacobian matrix analytically, but let’s use this example to learn how we would do so numerically.</p> <p>First, we need to get an expression for each element of the <a href="https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant">Jacobian matrix</a>.</p> <p>Recall the replicator dynamics:</p> $\begin{equation} \dot{p}_i = p_i (f_i - \bar{f}) \end{equation}$ <p>Each element of the Jacobian matrix</p> $\begin{equation} J_{i,k} = \left. \frac{\partial \dot{p}_i}{\partial p_k} \right|_{\boldsymbol{p}^*} = \left. [f_i - \overline{f}] \right|_{\boldsymbol{p}^*} + p_i^* \left( \left. \frac{\partial f_i}{\partial p_k} \right|_{\boldsymbol{p}^*} - \left. \frac{\partial \overline{f}}{\partial p_k} \right|_{\boldsymbol{p}^*} \right) \end{equation}$ <p>At $$\boldsymbol{p}^*$$, $$f_i = \overline{f}$$, so</p> $\begin{equation} J_{i,k} = p_i^* \left( \left. \frac{\partial f_i}{\partial p_k} \right|_{\boldsymbol{p}^*} - \left. \frac{\partial \overline{f}}{\partial p_k} \right|_{\boldsymbol{p}^*} \right) \tag{1} \end{equation}$ <p>Write the expression for each derivative individually, replacing the last variable: $$p_m = 1 - \sum_{j=1}^{m-1} p_j$$.</p> <p>To get the left-hand term in the Jacobian element, start with</p> \begin{align} f_i &amp;= \sum_{j=1}^m p_j \pi(i \mid j) \\ &amp;= \left[ \sum_{j=1}^{m-1} p_j \pi(i \mid j) \right] + \pi(i \mid m) \left[ 1 - \sum_{j=1}^{m-1} p_j \right] \\ &amp;=\left[ \sum_{j=1}^{m-1} p_j [\pi(i \mid j) - \pi(i \mid m)] \right] + \pi(i \mid m) \end{align} <p>Therefore:</p> $\begin{equation} \left. \frac{\partial f_i}{\partial p_k} \right|_{\boldsymbol{p}^*} = \pi(i \mid k) - \pi(i \mid m) \tag{left-hand term of (1)} \end{equation}$ <p>For the right-hand term in the Jacobian element, split the population average fitness effect into three terms</p> $\begin{equation} \overline{f} = \sum_j p_j f_j = \left[ \sum_{j=1, j\neq k}^{m-1} p_j f_j \right] + p_k f_k + p_m f_m \end{equation}$ <p>and take the derivatives of each term separately.</p> <p>The first term:</p> \begin{align} \left. \frac{\partial}{\partial p_k} \left[ \sum_{j=1, j \neq k}^{m-1} p_j f_j \right] \right|_{\boldsymbol{p}^*} &amp;= \sum_{j=1, j \neq k}^{m-1} p_j^* \left. \frac{\partial f_j}{\partial p_k} \right|_{\boldsymbol{p}^*} \\ &amp;=\sum_{j=1, j \neq k}^{m-1} p_j^* [\pi(j \mid k) - \pi(j \mid m)] \end{align} <p>The second term:</p> \begin{align} \left. \frac{\partial \left[ p_k f_k \right]}{\partial p_k} \right|_{\boldsymbol{p}^*} &amp;= \left. f_k \right|_{\boldsymbol{p}^*} + p_k^* \left. \frac{\partial f_k}{\partial p_k} \right|_{\boldsymbol{p}^*} \\ &amp;= \left[ \sum_{j=1}^m p^*_j \pi(k \mid j) \right] + p_k^* [\pi(k \mid k) - \pi(k \mid m)] \end{align} <p>The third term:</p> \begin{align} \left. \frac{\partial \left[ p_m f_m \right]}{\partial p_k} \right|_{\boldsymbol{p}^*} &amp;= \left. \frac{\partial }{\partial p_k} \left[1-\sum_{j=1}^{m-1} p_j \right] \right|_{\boldsymbol{p}^*} \left. f_m \right|_{\boldsymbol{p}^*} + p_m^* \left. \frac{\partial f_m}{\partial p_k} \right|_{\boldsymbol{p}^*} \\ &amp;= - \left[ \sum_{j=1}^m p_j^* \pi(m \mid j) \right] + p_m^* [\pi(m \mid k) - \pi(m \mid m)] \end{align} <p>So summing them together to get the right-hand term in the Jacobian element:</p> $\begin{equation} \left. \frac{\partial \overline{f}}{\partial p_k} \right|_{\boldsymbol{p}^*} = \sum_{j=1}^m p_j^* [ \pi(j \mid k) - \pi(j \mid m) + \pi(k \mid j) - \pi(m \mid j) ] \tag{right-hand term of (1)} \end{equation}$ <p>Let’s now code the Jacobian.</p> <p>First, code the payoffs so $$\pi(j \mid k) =$$ <code class="language-plaintext highlighter-rouge">pays[j][k]</code> and the interior steady state $$p_j^* =$$ <code class="language-plaintext highlighter-rouge">ps[j]</code>.</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">pays</span> <span class="o">=</span> <span class="p">[</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">4</span><span class="p">],</span> <span class="p">[</span> <span class="mi">1</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="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span> <span class="p">]</span> <span class="n">ps</span> <span class="o">=</span> <span class="n">fp_ba_tidy</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="c1"># recall the interior steady state was the third element</span></code></pre></figure> <p>Code the right-hand term of (1), $$\begin{equation} \left. \frac{\partial \overline{f}}{\partial p_k} \right|_{\boldsymbol{p}^*} \end{equation}$$</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">m</span> <span class="o">=</span> <span class="mi">2</span> <span class="c1"># because Python counts indices 0, 1, 2 instead of 1, 2, 3 </span><span class="n">dfbar_dps</span> <span class="o">=</span> <span class="p">[</span> <span class="nb">sum</span><span class="p">(</span><span class="n">ps</span><span class="p">[</span><span class="n">j</span><span class="p">]</span><span class="o">*</span><span class="p">(</span><span class="n">pays</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="n">k</span><span class="p">]</span><span class="o">-</span><span class="n">pays</span><span class="p">[</span><span class="n">j</span><span class="p">][</span><span class="n">m</span><span class="p">]</span> <span class="o">+</span> <span class="n">pays</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="o">-</span> <span class="n">pays</span><span class="p">[</span><span class="n">m</span><span class="p">][</span><span class="n">j</span><span class="p">])</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">))</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">2</span><span class="p">)]</span></code></pre></figure> <p>Code the full $$J_{i,k}$$ in (1)</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">J</span> <span class="o">=</span> <span class="n">np</span><span class="p">.</span><span class="n">array</span><span class="p">([</span> <span class="p">[</span><span class="n">ps</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">*</span><span class="p">(</span><span class="n">pays</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">k</span><span class="p">]</span> <span class="o">-</span> <span class="n">pays</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">m</span><span class="p">]</span> <span class="o">-</span> <span class="n">dfbar_dps</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">)]</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">2</span><span class="p">)</span> <span class="p">])</span></code></pre></figure> <p>We find that the Jacobian matrix is</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">J</span> <span class="n">array</span><span class="p">([[</span><span class="o">-</span><span class="mf">0.67857143</span><span class="p">,</span> <span class="mf">0.78061224</span><span class="p">],</span> <span class="p">[</span><span class="o">-</span><span class="mf">1.75</span> <span class="p">,</span> <span class="mf">0.75</span> <span class="p">]])</span></code></pre></figure> <p>and its eigenvalues</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">w</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="n">np</span><span class="p">.</span><span class="n">linalg</span><span class="p">.</span><span class="n">eig</span><span class="p">(</span><span class="n">J</span><span class="p">)</span> <span class="c1"># w are the eigenvalues, v are the eigenvectors </span><span class="n">w</span> <span class="n">array</span><span class="p">([</span><span class="mf">0.03571429</span><span class="o">+</span><span class="mf">0.92513099j</span><span class="p">,</span> <span class="mf">0.03571429</span><span class="o">-</span><span class="mf">0.92513099j</span><span class="p">])</span></code></pre></figure> <p>The maximum real part is positive, so the interior steady state is unstable.</p> <h3>References</h3> <p>Ohtsuki, H., &amp; Nowak, M. A. (2006). <a href="https://www.sciencedirect.com/science/article/abs/pii/S0022519306002426">The replicator equation on graphs</a>. Journal of Theoretical Biology, 243(1), 86-97.</p>nadiahkristensenRecently, I set a task for a student to use Python to analyse the replicator dynamics of a game with three strategies, including using the Jacobian to determine the stability of the steady state. The purpose of this blog post is to share the solution in case that’s useful to someone.Group nepotism and the Brothers Karamazov Game2022-11-10T04:44:54+00:002022-11-10T04:44:54+00:00https://nadiah.org/2022/11/10/group-nepotism<p>I recently read a classic paper by anthropologist Jones (2000), <a href="https://www.researchgate.net/profile/Doug-Jones/publication/271653816_Group_Nepotism_and_Human_Kinship/links/5577240608ae7521586e1319/Group-Nepotism-and-Human-Kinship.pdf"><em>‘Group nepotism and human kinship’</em></a>, which argues that collective action may explain some of the key features of human cooperation between kin. Collective action here is action by a group (e.g., clan, tribe) that has sufficient ingroup solidarity to decide how to act as a collective. The key features it may help explain are: 1. the ‘axiom of amity’, that one is obliged to help kin just because they’re kin; 2. that kin groups come in many sizes and can be quite large; and 3. that human notions of kinship can be very different from biological kinship, sometimes occurring between individuals with no known geneological relationship.</p> <p>The paper gives many detailed examples and arguments for why real-world social kinship has the features we would expect if group nepotism — combining relatedness with collective action — was an important mechanism (and also a section on ethnocentrism), which I cannot do justice here. Instead, the purpose of this blog post is to simply to teach myself about the basic idea by working through the first model in the paper.</p> <h3>Model background</h3> <p>The first model is called the Brothers Karamazov Game, named after the Dostoevsky novel. I’ve never read <em>The Brothers Karamazov</em>, but I gather there are three brothers — Ivan, Alyosha, and Dmitri — and Dmitri is prone to making poor life choices. The question is, should Ivan and Alyosha help out their brother Dmitri?</p> <p>When Ivan and Alyosha act independently, then the rule for helping Dmitri to a benefit $$B$$ at a cost $$C$$ follows directly from Hamilton’s rule. The coefficient of relatedness between full siblings is $$r=1/2$$; therefore, Ivan (or Alyosha) should help Dmitri if the benefit to Dmitri is at least twice the cost, $$B/C &gt; 1/r = 2$$. However, Jones shows this constraint can be made much easier to overcome if Ivan and Alyosha act together.</p> <p>Jones introduces a situation he calls “conditional nepotism”: Ivan proposes to Alyosha that he will help out Dmitri <em>if and only if</em> Alyosha agrees to do the same. If Alyosha agrees to this, then when we add up Ivan’s inclusive fitness costs and benefits (details below), the pooling of nepotistic effort leads for a condition for helping $$B/C &gt; 1/r_c$$ where $$r_c &gt; r$$. In other words, provided Alyosha agrees, then Ivan should treat Dmitri as though he is even <em>more</em> related to him than he really is. This is an interesting result because it might help explain why helping between kin — culturally defined — is common in hunter-gatherer societies even though relatedness coefficients between pairs of individuals are often quite low.</p> <h3>Approach</h3> <p>I will now work through the sexual haploid case in the first appendix. However, instead of using Jones’ method, I will try performing the calculations using the framework provided in Ohtsuki (2014; Proc R Soc B).</p> <p>Ohtsuki’s method allows us to describe the replicator dynamics of two strategies $$A$$ and $$B$$ in nonlinear games played between kin by taking into account the <em>higher-order genetic associations</em> between group members, beyond their dyadic relatedness. Dyadic relatedness $$r$$ above is the probability that 2 individuals randomly drawn without replacement from the group will have strategies that are identical by descent, denoted $$\theta_{2 \rightarrow 1}$$ in Ohtsuki’s scheme. We can also say in shorthand that the two individuals “share a common ancestor”. Higher-order relatedness generalises this concept to larger samples. For example, $$\theta_{3 \rightarrow 1}$$ is the probability that three individuals randomly drawn share a common ancestor, and in general, $$\theta_{l \rightarrow m}$$ is the probability that, if we draw $$l$$ individuals from the group, they share $$m$$ common ancestors.</p> <p>The higher-order genetic associations $$\theta_{l \rightarrow m}$$ can then be used to find the probilities $$\rho_l$$ that $$l$$ players randomly sampled from the group without replacement are $$A$$-strategists (Eq. 2.5):</p> $\rho_l = \sum_{m=1}^l \theta_{l \rightarrow m} p^m$ <p>where $$p$$ is the proportion of $$A$$-strategists in the population and $$\rho_0=1$$.</p> <p>The reasoning behind the $$\rho_l$$ equation can be seen by considering the probability that two randomly sampled group members are $$A$$-strategists, $$\rho_2$$. Either the two individuals have the same ancestor, or they have different ancestors. Assuming that the proportion of $$A$$-strategists in the ancestral population can be approximated by the proportion of $$A$$-strategists now, then:</p> $\rho_2 = \quad \underbrace{\theta_{2 \rightarrow 1}}_{\substack{\text{same} \\ \text{ancestor}}} \quad \underbrace{p}_{\substack{\text{ancestor} \\ \text{=A}} } \quad + \quad \underbrace{\theta_{2 \rightarrow 2}}_{\substack{\text{two} \\ \text{ancestors}} } \quad \underbrace{p^2}_{\substack{\text{both} \\ \text{=A}}}$ <p>Let’s define the payoffs to the two strategies using two functions: $$a_k$$ is the payoff to $$A$$-strategists when $$k$$ of the $$n-1$$ other group members are $$A$$-strategists, and $$b_k$$ is the payoff to $$B$$-strategists when $$k$$ of the $$n-1$$ other group members are also $$A$$-strategists.</p> <p>Then Ohtsuki (2014) shows that the change in the proportion $$A$$-strategists in the population, $$p$$, over one generation is proportional to (Eq. 2.4)</p> $\Delta p \propto \sum_{k=0}^{n-1} \sum_{l=k}^{n-1} (-1)^{l-k} {l \choose k} {n-1 \choose l} \left[ (1-\rho_1) \rho_{l+1} a_k - \rho_1(\rho_l - \rho_{l+1}) b_k \right].$ <p>This equation is derived from first principles from the Price equation (see Ohtsuki (2014) appendices).</p> <h3>Results</h3> <h4>Dynamics equation</h4> <p>The number of terms in the dynamics equation quickly becomes unweildy, so I’ll use <a href="https://www.sagemath.org/">SageMath</a> below to work through the algebra.</p> <p>First, I will prepare the symbolic function “$$\Delta p \propto \ldots$$”</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="o">%</span><span class="n">display</span> <span class="n">latex</span> <span class="n">var</span><span class="p">(</span><span class="s">'B, C'</span><span class="p">)</span> <span class="c1"># benefit and cost of helping behaviour </span><span class="n">n</span> <span class="o">=</span> <span class="mi">3</span> <span class="c1"># size of the group (3 brothers) </span> <span class="c1"># a placeholder for the payoff functions a_k and b_k we'll define later </span><span class="n">a</span> <span class="o">=</span> <span class="n">function</span><span class="p">(</span><span class="s">'a'</span><span class="p">)</span> <span class="n">b</span> <span class="o">=</span> <span class="n">function</span><span class="p">(</span><span class="s">'b'</span><span class="p">)</span> <span class="c1"># a placeholder for the rho function we'll define later </span><span class="n">rho</span> <span class="o">=</span> <span class="n">function</span><span class="p">(</span><span class="s">'rho'</span><span class="p">)</span> <span class="n">var</span><span class="p">(</span><span class="s">'l,k'</span><span class="p">)</span> <span class="c1"># sum counters </span> <span class="c1"># Eq. 2.4 from Ohtsuki (2014) </span><span class="n">delta_pr</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span><span class="nb">sum</span><span class="p">((</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">l</span><span class="o">-</span><span class="n">k</span><span class="p">)</span> <span class="o">*</span> <span class="n">binomial</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="o">*</span> <span class="n">binomial</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="p">(</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">rho</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span><span class="o">*</span><span class="n">rho</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="o">*</span><span class="n">a</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> <span class="o">-</span> <span class="n">rho</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">rho</span><span class="p">(</span><span class="n">l</span><span class="p">)</span><span class="o">-</span><span class="n">rho</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="o">*</span><span class="n">b</span><span class="p">(</span><span class="n">k</span><span class="p">)</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="n">n</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="mi">0</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">delta_pr</span></code></pre></figure> $\begin{gather} -{\left(a\left(0\right) + 2 \, b\left(1\right) - 3 \, b\left(0\right)\right)} \rho\left(1\right)^{2} - {\left({\left(\rho\left(1\right) - 1\right)} a\left(2\right) - {\left(2 \, a\left(1\right) - a\left(0\right) - 2 \, b\left(1\right) + b\left(0\right)\right)} \rho\left(1\right) - b\left(2\right) \rho\left(1\right) + 2 \, a\left(1\right) - a\left(0\right)\right)} \rho\left(3\right) \\ - {\left({\left(2 \, a\left(1\right) - 2 \, a\left(0\right) - 4 \, b\left(1\right) + 3 \, b\left(0\right)\right)} \rho\left(1\right) + b\left(2\right) \rho\left(1\right) - 2 \, a\left(1\right) + 2 \, a\left(0\right)\right)} \rho\left(2\right) - {\left(b\left(0\right) \rho\left(0\right) - a\left(0\right)\right)} \rho\left(1\right) \end{gather}$ <p>The example in Section 4(b) of Ohtsuki (2014) provides us with expressions for the higher-order relatedness terms between siblings. Define the dyadic relatedness $$r = \theta_{2 \rightarrow 1}$$ as before, and define the triplet relatedness $$s = \theta_{3 \rightarrow 1}$$. Then it can be shown:</p> \begin{align} \theta_{1 \rightarrow 1} &amp;= 1, \\ \theta_{2 \rightarrow 1} &amp;= r, \\ \theta_{2 \rightarrow 2} &amp;= 1-r, \\ \theta_{3 \rightarrow 1} &amp;= s, \\ \theta_{3 \rightarrow 2} &amp;= 3r - 3s, \\ \theta_{3 \rightarrow 3} &amp;= 1 - 3r + 2s. \end{align} <p>Between siblings, $$r = 1/2$$ and $$s = 1/4$$, therefore</p> \begin{align} \rho_1 &amp;= \theta_{1 \rightarrow 1} p = p, \\ \rho_2 &amp;= \theta_{2 \rightarrow 1} p + \theta_{2 \rightarrow 2} p^2 = \frac{p}{2} + \frac{p^2}{2}, \\ \rho_3 &amp;= \theta_{3 \rightarrow 1} p + \theta_{3 \rightarrow 2} p^2 + \theta_{3 \rightarrow 3} p^3 = \frac{p}{4} + \frac{3p^2}{4} \end{align} <p>We will substitute these expressions for $$\rho_l$$ into the symbolic function:</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">var</span><span class="p">(</span><span class="s">'p'</span><span class="p">)</span> <span class="n">delta_pr</span> <span class="o">=</span> <span class="n">delta_pr</span><span class="p">.</span><span class="n">subs</span><span class="p">({</span> <span class="n">rho</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="n">rho</span><span class="p">(</span><span class="mi">1</span><span class="p">):</span> <span class="n">p</span><span class="p">,</span> <span class="n">rho</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span> <span class="n">p</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">p</span><span class="o">^</span><span class="mi">2</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="n">rho</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span> <span class="n">p</span><span class="o">/</span><span class="mi">4</span> <span class="o">+</span> <span class="mi">3</span><span class="o">*</span><span class="n">p</span><span class="o">^</span><span class="mi">2</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="p">})</span> <span class="n">delta_pr</span></code></pre></figure> $\begin{gather} -p^{2} {\left(a\left(0\right) + 2 \, b\left(1\right) - 3 \, b\left(0\right)\right)} + \frac{1}{4} \, {\left(3 \, p^{2} + p\right)} {\left(p {\left(2 \, a\left(1\right) - a\left(0\right) - 2 \, b\left(1\right) + b\left(0\right)\right)} - {\left(p - 1\right)} a\left(2\right) + p b\left(2\right) - 2 \, a\left(1\right) + a\left(0\right)\right)} \\ - \frac{1}{2} \, {\left(p^{2} + p\right)} {\left(p {\left(2 \, a\left(1\right) - 2 \, a\left(0\right) - 4 \, b\left(1\right) + 3 \, b\left(0\right)\right)} + p b\left(2\right) - 2 \, a\left(1\right) + 2 \, a\left(0\right)\right)} + p {\left(a\left(0\right) - b\left(0\right)\right)} \end{gather}$ <p>Now we have an expression proportional to $$\Delta p$$ to which we can apply different payoff functions $$a_k$$ and $$b_k$$.</p> <h4>Unconditonal helping vs. defection</h4> <p>First, let’s consider the case where the two brothers always help Dmitri regardless of what the other does. We already know the answer whether or not this behaviour can evolve, it follows directly from Hamilton’s Rule, so this also serves to sanity-check the calculations.</p> <p>Let the $$A$$ strategy be unconditional helping and $$B$$ be defection. When the focal player is playing the role of Dmitri, which is drawn with probability $$1/3$$, their payoffs are independent of their strategy</p> $\begin{pmatrix} a_0 &amp; a_1 &amp; a_2 \\ b_0 &amp; b_1 &amp; b_2 \end{pmatrix} = \begin{pmatrix} 0 &amp; B &amp; 2B \\ 0 &amp; B &amp; 2B \end{pmatrix}$ <p>If the focal is not a Dmitri (occurs with probability 2/3), the payoffs to the focal depend on whether or not they help the Dmitri</p> $\begin{pmatrix} a_0 &amp; a_1 &amp; a_2 \\ b_0 &amp; b_1 &amp; b_2 \end{pmatrix} = \begin{pmatrix} -C &amp; -C &amp; -C \\ 0 &amp; 0 &amp; 0 \end{pmatrix}$ <p>Therefore, when the brothers act independently, the expected payoffs</p> $\begin{pmatrix} a_0 &amp; a_1 &amp; a_2 \\ b_0 &amp; b_1 &amp; b_2 \end{pmatrix} = \frac{1}{3} \begin{pmatrix} -2C &amp; B-2C &amp; 2B-2C \\ 0 &amp; B &amp; 2B \end{pmatrix}$ <p>Substituting these payoffs into the expression proportional to $$\Delta p$$</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">uncond_delta_pr</span> <span class="o">=</span> <span class="n">delta_pr</span><span class="p">.</span><span class="n">subs</span><span class="p">({</span> <span class="n">a</span><span class="p">(</span><span class="mi">0</span><span class="p">):</span> <span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">C</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">a</span><span class="p">(</span><span class="mi">1</span><span class="p">):</span> <span class="n">B</span><span class="o">/</span><span class="mi">3</span> <span class="o">-</span> <span class="mi">2</span><span class="o">*</span><span class="n">C</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">a</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span> <span class="mi">2</span><span class="o">*</span><span class="n">B</span><span class="o">/</span><span class="mi">3</span> <span class="o">-</span> <span class="mi">2</span><span class="o">*</span><span class="n">C</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">0</span><span class="p">):</span> <span class="mi">0</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">):</span> <span class="n">B</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span> <span class="mi">2</span><span class="o">*</span><span class="n">B</span><span class="o">/</span><span class="mi">3</span> <span class="p">})</span> <span class="n">uncond_delta_pr</span> <span class="o">=</span> <span class="n">uncond_delta_pr</span><span class="p">.</span><span class="n">expand</span><span class="p">().</span><span class="n">factor</span><span class="p">()</span> <span class="n">uncond_delta_pr</span></code></pre></figure> $-\frac{1}{3} \, {\left(B - 2 \, C\right)} {\left(p - 1\right)} p$ <p>The condition for the $$A$$-strategist (the ones who help Dmitri) to increase is</p> $B-2C &gt; 0$ <p>and the condition is</p> $B/C &gt; 2 = 1/r$ <p>as expected.</p> <h4>Conditional nepotism vs. defection</h4> <p>Now let’s consider Jones’ scenario, where Ivan and Alyosha help Dmitri if and only if they both agree, i.e., they are both conditional nepotists.</p> <p>You might notice in the first appendix that Jones talks about a ‘conditional nepotists’ vs ‘Hamiltonian nepotists’ scenario, which confused me at first, because when you look at the payoffs Table A2, there’s no helping by the Hamiltonian $$H$$ type. I <em>think</em> what’s happening is he is actually restricting his attention to the situation $$B/C &lt; 2$$, and assuming that what he calls ‘Hamiltonian nepotists’ will decide to not help Dmitri in this situation, i.e., act like defectors (see wording of the paragraph right after Eq. A1). Therefore, the scenario in question is actually ‘conditional nepotists vs defectors’. Hopefully this will become clear by the time we’ve gone through all the cases (final figure summary).</p> <p>Let the $$A$$ strategy be conditional nepotism and the $$B$$ strategy be defection. When the focal player is a Dmitri (probability $$1/3$$), their payoffs are again independent of their strategy</p> $\begin{pmatrix} a_0 &amp; a_1 &amp; a_2 \\ b_0 &amp; b_1 &amp; b_2 \end{pmatrix} = \begin{pmatrix} 0 &amp; 0 &amp; 2B \\ 0 &amp; 0 &amp; 2B \end{pmatrix}$ <p>When the focal player is not a Dmitri (probability 2/3), their payoffs are</p> $\begin{pmatrix} a_0 &amp; a_1 &amp; a_2 \\ b_0 &amp; b_1 &amp; b_2 \end{pmatrix} = \begin{pmatrix} 0 &amp; -C/2 &amp; -C \\ 0 &amp; 0 &amp; 0 \end{pmatrix}$ <p>where $$a_1 = -C/2$$ because, if there is one other helper in the group, there is half a chance that the other helper is also not a Dmitri and thus the $$A$$-strategist gives the help.</p> <p>Therefore, when the brothers act as conditional nepotists, the expected payoffs</p> $\begin{pmatrix} a_0 &amp; a_1 &amp; a_2 \\ b_0 &amp; b_1 &amp; b_2 \end{pmatrix} = \frac{1}{3} \begin{pmatrix} 0 &amp; -C &amp; 2B-2C \\ 0 &amp; 0 &amp; 2B \end{pmatrix}$ <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">cond_delta_pr</span> <span class="o">=</span> <span class="n">delta_pr</span><span class="p">.</span><span class="n">subs</span><span class="p">({</span> <span class="n">a</span><span class="p">(</span><span class="mi">0</span><span class="p">):</span> <span class="mi">0</span><span class="p">,</span> <span class="n">a</span><span class="p">(</span><span class="mi">1</span><span class="p">):</span> <span class="o">-</span><span class="n">C</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">a</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span> <span class="mi">2</span><span class="o">*</span><span class="n">B</span><span class="o">/</span><span class="mi">3</span> <span class="o">-</span> <span class="mi">2</span><span class="o">*</span><span class="n">C</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">0</span><span class="p">):</span> <span class="mi">0</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">):</span> <span class="mi">0</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span> <span class="mi">2</span><span class="o">*</span><span class="n">B</span><span class="o">/</span><span class="mi">3</span> <span class="p">})</span> <span class="n">cond_delta_pr</span> <span class="o">=</span> <span class="n">cond_delta_pr</span><span class="p">.</span><span class="n">expand</span><span class="p">().</span><span class="n">factor</span><span class="p">()</span> <span class="n">cond_delta_pr</span></code></pre></figure> $-\frac{1}{6} \, {\left(2 \, B p - 2 \, C p + B - 2 \, C\right)} {\left(p - 1\right)} p$ <p>The condition for conditional nepotists to increase matches the equation that Jones presents in the appendix (Eq. A1)</p> $2Bp - 2Cp + B - 2C &gt; 0$ <p>or</p> $\frac{B}{C} &gt; \frac{2 + 2p}{1 + 2p} \equiv \frac{1}{r_c}.$ <p>As $$p$$ increases from 0 to 1, $$r_c$$ above increases from 1/2 to 3/4, meaning that when $$p$$ is high, the brothers will treat Dmitri as though he is more related to them than he really is. Conditional nepotists can invade defectors when (sub in $$p=0$$) $$B/C &gt; 2$$. Defectors can invade conditional nepotists (sub in $$p=1$$, reverse condition) when $$B/C &lt; 4/3$$.</p> <p>Let’s plot some examples of the $$\Delta p$$ vs $$p$$ function to get a more intuitive feel. When $$B/C = 2.5 &gt; 2$$, we see below that $$\Delta p$$ is always greater than zero.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/cond_1.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/cond_1.png" alt="Change in proportion of conditional nepotists when $$B/C = 2.5$$" /> </a> <figcaption><span>Change in proportion of conditional nepotists when $$B/C = 2.5$$</span></figcaption> </figure> <p>When $$B/C = 1.5$$ (satisfying $$4/3 &lt; B/C &lt; 2$$), we see that $$\Delta p$$ is less than zero when $$p$$ is small, and greater than zero when $$p$$ is large. There are two stable steady states — all Defectors and all Conditional Nepotists — and a separatrix between them. The position of the separatrix is found by setting the $$B/C$$ condition above to an equality: $$p^{\star} = \frac{2C-B}{2B-2C}$$.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/cond_2.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/cond_2.png" alt="Change in proportion of conditional nepotists when $$B/C = 1.5$$." /> </a> <figcaption><span>Change in proportion of conditional nepotists when $$B/C = 1.5$$.</span></figcaption> </figure> <p>When $$B/C = 1.2 &lt; 4/3$$, $$\Delta p$$ is always below zero. All-defectors is the evolutionary endpoint.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/cond_3.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/cond_3.png" alt="Change in proportion of conditional nepotists when $$B/C = 1.2$$." /> </a> <figcaption><span>Change in proportion of conditional nepotists when $$B/C = 1.2$$.</span></figcaption> </figure> <h4>Conditional nepotism vs. unconditional helping</h4> <p>For completeness, we should now consider the case of ‘conditional nepotists’ vs ‘unconditional helpers’. Let the $$A$$ strategy be conditional nepotism and the $$B$$ strategy be unconditional helping. Substituting in the expected payoffs:</p> <figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">x_delta_pr</span> <span class="o">=</span> <span class="n">delta_pr</span><span class="p">.</span><span class="n">subs</span><span class="p">({</span> <span class="n">a</span><span class="p">(</span><span class="mi">0</span><span class="p">):</span> <span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">B</span><span class="p">)</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">a</span><span class="p">(</span><span class="mi">1</span><span class="p">):</span> <span class="p">(</span><span class="n">B</span><span class="o">-</span><span class="n">C</span><span class="p">)</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">a</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span> <span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">B</span><span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">C</span><span class="p">)</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">0</span><span class="p">):</span> <span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">B</span><span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">C</span><span class="p">)</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">):</span> <span class="p">(</span><span class="n">B</span><span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">C</span><span class="p">)</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">b</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span> <span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">B</span><span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">C</span><span class="p">)</span><span class="o">/</span><span class="mi">3</span> <span class="p">})</span> <span class="n">x_delta_pr</span> <span class="o">=</span> <span class="n">x_delta_pr</span><span class="p">.</span><span class="n">expand</span><span class="p">().</span><span class="n">factor</span><span class="p">()</span> <span class="n">x_delta_pr</span></code></pre></figure> $-\frac{1}{6} \, {\left(2 \, B p - 2 \, C p - B + 2 \, C\right)} {\left(p - 1\right)} p$ <p>The condition for conditional nepotists to increase is</p> $B(2p-1) &gt; C(2p-2)$ <p>which splits up into two cases. When $$p &gt; 1/2$$, the condition becomes</p> $\frac{B}{C} &gt; \frac{2p-2}{2p-1}$ <p>and so conditional nepotists can always grow. When $$p &lt; 1/2$$, the condition becomes</p> $\frac{B}{C} &lt; \frac{2p-2}{2p-1}$ <p>and conditional nepotists can only invade ($$p=0$$) if $$B/C &lt; 2$$.</p> <p>Let’s again plot some examples to obtain the intuition. First, let’s plot an example where $$B/C &lt; 2$$. The $$p^*=0$$ steady state is unstable, $$p^* =1$$ is stable, and there are no interior equilibria. Therefore, conditional nepotists can invade, and an all-conditional-nepotists population is the evolutionary endpoint.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/cross_1.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/cross_1.png" alt="Change in proportion of conditional nepotists when $$B/C = 1.5$$." /> </a> <figcaption><span>Change in proportion of conditional nepotists when $$B/C = 1.5$$.</span></figcaption> </figure> <p>Now let’s see how the situation changes as we move to the $$B/C &gt; 2$$ space. In the plot below, we see how, when we reach $$B/C = 2$$, an interior separatrix appears, so now there are two evolutionarily stable states: all conditional nepotists, and all unconditional helpers. So conditional nepotists cannot invade, but once established, they can resist invasion by unconditional helpers.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/cross_2.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/cross_2.png" alt="Change in proportion of conditional nepotists for a range of $$B/C$$ values." /> </a> <figcaption><span>Change in proportion of conditional nepotists for a range of $$B/C$$ values.</span></figcaption> </figure> <p>As $$B/C$$ becomes larger, the separatrix moves to the right. When we plot an example with large $$B/C$$, the separatrix is close to $$p \approx 1/2$$, as suggested above.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/cross_3.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/cross_3.png" alt="Change in proportion of conditional nepotists for $$B/C = 100$$." /> </a> <figcaption><span>Change in proportion of conditional nepotists for $$B/C = 100$$.</span></figcaption> </figure> <h4>Summary of dynamics</h4> <p>All evolutionary endpoints are monomorphic, so I summarised the evolutionary dynamics in terms of pairwise invasibility below.</p> <p>When benefits are high compared to costs, defectors cannot prevail. The evolutionary endpoints are conditional nepotists or unconditional helpers. When benefits are intermediate $$4/3 &lt; B/C &lt; 2$$, unconditional helpers are no longer evolutionarily stable. Either defectors or conditional nepotists will prevail. When benefits are low, defectors prevail.</p> <figure style="max-width: 700px; margin: auto; padding-bottom: 20px;"> <a href="/wp-content/uploads/2022/11/summary.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/summary.png" alt="A summary of the evolutionary dynamics of the Brothers Karamazov game across three regimes determined by the cost-benefit ratio. White circles indicate evolutionary endpoints, directions of arrows indicate whether populations are resistant to invasion or invasible, and solid lines on edges indicate separatrices." /> </a> <figcaption><span>A summary of the evolutionary dynamics of the Brothers Karamazov game across three regimes determined by the cost-benefit ratio. White circles indicate evolutionary endpoints, directions of arrows indicate whether populations are resistant to invasion or invasible, and solid lines on edges indicate separatrices.</span></figcaption> </figure> <p>Conditional nepotists can never invade. However, if the benefits are close to but just above $$B/C = 2$$, the separatrix between conditional nepotists and unconditional helpers is close to zero. This suggests that, if a cluster of unconditional helpers have a brainwave and strike upon the idea of making a deal like Jones describes, then they might be able to invade and explore the new space of potential collaborative situations not previously accessible to the unconditional helpers. The separatrix between conditional nepotists and defectors is near 0 when $$B/C$$ is near $$2$$, so they will (at least, initially), be quite resistant to invasion by defectors.</p> <h3>Conclusion</h3> <p>The Brothers Karamazov model above is only the first of 3 models that Jones (2000) discusses. In the second model, Jones considers a large donor group facing the choice of whether to help another group of relatives. Through a similar principle to “conditional nepotism” above, the donor group decides as a collective whether or not to help, i.e., “group nepotism”. Analogous to $$r_c$$ above, “group coefficient of relatedness” $$r_g$$ is obtained from the condition $$B/C &gt; 1/r_g$$, and it too can be larger than dyadic relatedness $$r$$.</p> <p>Table 1 below compares estimates of the dyadic relatedness (labelled $$r_{11}$$ in the talbe) and the group coefficient of relatedness for a sampling of tribal societies. Group relatedness is often much higher than dyadic relatedness, sometimes nearing 1. This suggests that, <em>if</em> groups of relatives can somehow coordinate themselves and act as a collective, then they will render help more easily than one would expect just from individual inclusive fitness considerations alone.</p> <figure style="max-width: 700px; margin: auto;"> <a href="/wp-content/uploads/2022/11/Jones_Table.png"> <img style="max-height: auto; max-width: 100%;" src="/wp-content/uploads/2022/11/Jones_Table.png" alt="" /> </a> </figure> <p>Jones proposes that such collective behaviour might be achieved by “mutual coercion, mutually agreed upon”, and gives many real-life anthropological examples where individuals are punished for not obeying norms about how one ought to treat their (culturally defined) kin. Models that also include coercion (punishment) could be used to learn more about the exact conditions under which this can evolve. So I have more reading to do.</p> <h3>Further reading</h3> <p>Jones, D. (15 June, 2016). Blog post: “Beating Hamilton’s Rule”, <a href="https://logarithmichistory.wordpress.com/2016/06/15/beating-hamiltons-rule/">https://logarithmichistory.wordpress.com/2016/06/15/beating-hamiltons-rule/</a></p> <h3>References</h3> <p>Jones, D. (2000). Group nepotism and human kinship. <a href="https://www.journals.uchicago.edu/doi/abs/10.1086/317406">Current Anthropology</a>, 41(5): 779-809</p> <p>Ohtsuki, H. (2014). Evolutionary dynamics of n-player games played by relatives. <a href="https://royalsocietypublishing.org/doi/full/10.1098/rstb.2013.0359">Philosophical Transactions of the Royal Society B: Biological Sciences</a>, 369(1642), 20130359.</p>nadiahkristensenI recently read a classic paper by anthropologist Jones (2000), ‘Group nepotism and human kinship’, which argues that collective action may explain some of the key features of human cooperation between kin. Collective action here is action by a group (e.g., clan, tribe) that has sufficient ingroup solidarity to decide how to act as a collective. The key features it may help explain are: 1. the ‘axiom of amity’, that one is obliged to help kin just because they’re kin; 2. that kin groups come in many sizes and can be quite large; and 3. that human notions of kinship can be very different from biological kinship, sometimes occurring between individuals with no known geneological relationship.Lab 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} &amp;= \sum_i \dot{n_i} \\ &amp;= \beta \sum_i n_i + \sum_i f_i n_i \\ &amp;= \beta N + N \sum_i f_i \frac{n_i}{N} \\ &amp;= \beta N + N \sum_i f_i p_i \\ \dot{N} &amp;= 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} &amp;= p \, (f_C - [p f_C + (1-p) f_D]) \\ \dot{p} &amp;= 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 &amp;\text{if } i &gt;= k \text{ (threshold met)}\\ 0 &amp;\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">&gt;=</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 &amp; \text{if threshold met,} \\ -c &amp; \text{if threshold not met.} \end{cases}$ <p>and defectors receive</p> $\text{defector payoff} = \begin{cases} b &amp; \text{if threshold met,} \\ 0 &amp; \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}.$ <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">'&lt;-&gt;'</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> <p>Why is the pivot probability significant? First, consider just a single game, and imagine I know that I am the pivotal player. If I am a cooperator, then it is in my interests to remain a cooperator because if I switch then I will reduce my own payoff. If I am defector and I have the option of switching strategies, I would want to switch to cooperate.</p> <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> <p>We can also intuit that, if the probability that I will end up in a game where I am the pivotal player is high, then assuming I have a fixed strategy that I play all the time, it might be in my interests to be a cooperator… We’ll return to this point soon.</p> <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">'-&gt;'</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">'&lt;-'</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">'-&gt;'</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 &gt;=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 &lt; k &lt; 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 &lt; k &lt; n$$</h4> <p><strong>Low cost</strong></p> <p>When participation costs are small ($$c &lt; \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 &lt; 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 &gt; \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 &gt; 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 &gt; 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 &lt; 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., &amp; 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., &amp; 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., &amp; 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., &amp; 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. &amp; 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 &amp; 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 (&gt; 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 &gt; 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 &amp; 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:  Thompson et al. (2019);  Cunha (2016);  Domínguez-Rodrigo et al. (2005);  Domínguez-Rodrigo et al. (2021);  Bramble (2004);  Pobiner (2020);  Bickerton &amp; Szathmáry (2011);  Wilkins et al. (2012);  Oakley et al. (1977);  Allington-Jones (2015);  Lombard (2016);  Balme (2018);  Marwick (2003);  Balme and Morse (2006);  Smith et al. (1998);  Brooks et al. (2018);  Balme et al. (2009);  Sehasseh et al. (2021);  Gamble et al. (2011);  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:  Thompson et al. (2019);  Cunha (2016);  Domínguez-Rodrigo et al. (2005);  Domínguez-Rodrigo et al. (2021);  Bramble (2004);  Pobiner (2020);  Bickerton &amp; Szathmáry (2011);  Wilkins et al. (2012);  Oakley et al. (1977);  Allington-Jones (2015);  Lombard (2016);  Balme (2018);  Marwick (2003);  Balme and Morse (2006);  Smith et al. (1998);  Brooks et al. (2018);  Balme et al. (2009);  Sehasseh et al. (2021);  Gamble et al. (2011);  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., &amp; Hamilton, W. D. (1981). The evolution of cooperation. Science, 211(4489), 1390-1396.</p> <p>Balme, J., Davidson, I., McDonald, J., Stern, N., &amp; 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., &amp; 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., &amp; 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., &amp; 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., &amp; 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., &amp; 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., &amp; 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., &amp; 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. &amp; 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., &amp; 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 &amp; 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) &amp;= 1 - w + w \pi_c(i, h), \\ \pi^w_d(i, h) &amp;= 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) &amp;= \beta - \gamma, \\ \pi_d(i, h) &amp;= \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 &amp; \mathbf{0} \\ R &amp; 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} &gt; 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 &gt; f_D$$, which is</p> $b \sum_i m_i^2 - c \sum_i m_i n_i &gt; \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 &gt; \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 &gt; \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} &amp;= \frac{\text{payoff to Cooperator with tag }i}{\text{payoff to all Cooperators} + \text{payoff to all Defectors}} \\ &amp;= \frac{N f_{C,i}}{\sum_j m_j f_{C,j} + (n_j - m_j) f_{D,j}} \\ &amp;= \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) &amp;= w_{C,i}(a) + w_{C,i}'(a)(\delta-a) + \frac{w_{C,i}''(a)}{2} (\delta-a)^2 + \ldots \nonumber \\ &amp;= \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 \\ &amp;= 1 + \delta(A-B) + \mathcal{O}(\delta^2) \nonumber \\ &amp;= 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 &gt; 0. \label{invasion_condition} \tag{3}$ <p>For a given population configuration</p> \begin{align} \Delta p(s) &amp;= \frac{1}{N} \left( \text{number of Cooperator offspring born} - \text{number of Cooperator adults died} \right) \nonumber \\ &amp;= \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 &amp;= \sum_s \pi(s) \Delta p(s) \\ &amp; = \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] \\ %&amp; = \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 \\ &amp; = \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) \\ &amp; \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} &amp;= 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} &amp;= 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} &amp;= 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} &amp;= 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 &gt; 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 &gt; 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 &gt; \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 &lt;&lt; 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 &amp; 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., &amp; 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. &amp; 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 &amp; Nöldeke 2016, Nöldeke &amp; Peña 2016, Peña &amp; Nöldeke 2018, Nöldeke &amp; 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 &amp;= \sum_{i=0}^{n-1} p_{i,n-1}(x) b(i+1) - c, \\ W_D &amp;= \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., &amp; 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. &amp; 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. &amp; 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. &amp; 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. &amp; Lehmann, L. (2015). Evolutionary dynamics of collective action in spatially structured populations. Journal of Theoretical Biology, 382, 122–136.</p> <p>Peña, J., &amp; 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., &amp; 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 &amp; Nöldeke 2016, Nöldeke &amp; Peña 2016, Peña &amp; Nöldeke 2018, Nöldeke &amp; Peña 2020). I this blog post, I used a paper by Archetti (2018) to teach myself more about the topic.