## Roteiros

en:ecovirt:roteiro:neutr:neutrar

# Neutral Theory of Biodiversity - Tutorial in R

The neutral theory is a model based in stochastic birth, death, speciation and migration. The probabilities of each event define a rather surprising dynamic for the system. To understand it, let's simulate the process in the following tutorial.

## Preparation: Understanding Random Walks

The neutral theory builds on a class of stochastic models called zero-sum random walk. To understand some important properties of this dynamic models, follow these tutorials on random walks:

The concepts presented in these tutorials are of central importance to understand the neutral theory. When you are sure you have understood them, get back to this tutorial.

## The theory, step by step

To proceed, you must have the R environment with the Ecovirtual package installed and loaded. If you do not have and do not know how to have them, see the Installation page.

Now that we know some basic properties of Markov chains we can build a stochastic model for the neutral theory, step by step, inside EcoVirtual.

#### Local dynamics without migration

Let's start with a model for a community using a zero-sum game, just like the gambling game seen on the Silly Game tutorial. The rules are:

1. The community has a fixed number of individuals $J$, that never changes.
2. At the start, every population has the same number of individuals $j$, found by solving $J = jS$ (where $S$ is the number of species1)
3. At each step, one individual is chosen at random and dies
4. From the remaining individuals, one is drawn to generate an offspring. This offspring will take the dead individual place, making the total population size $J$ again.

To simulate this process, we have a great function in the EcoVirtual package.simHub12).

Our simulation function has the following parameters:

Option parameter definition
Number of SpeciesS number of species
Individuals per Speciesj initial population size for each species $j$
Number of dead per cycleD number of deaths at every iteration3)
Cycles per simulation cycle number of iterations per simulation

Simulate a community with 100 species and 2 individuals in each species. Rinse and repeat a couple of times.

S = 100
j = 2

What happens to the number of species as time passes? Determine what happens if you increase the size of the community (the product $Sj$). Try raising the $j$ to 12, with intervals of 2, and repeat a couple of times for each value.

S= 100
j = 2 a 12, a intervalos de 2

## Including migration

We know that communities are not closed systems. So the arrival of migrants may be able to compensate for the loss of species we have observed in the simulation above. Let's assume that there is an external repository of migrants, which we will call metacommunity. A simple way of doing so is by postulating an infinite metacommunity, with all of the species present at the start of the simulation, and in the same proportion. We need then to determine the migration rate: it will determine what is the probability that a dead individual in the community will be replaced by a propagule coming from outside, i.e., from the metacommunity.

Now,use the function simHub2 with the migration parameter $m$.

Compare the dynamic of the number of species over time on a community with and without migration, and with increasing values for the migration rate (try values from 0 to 0.5). Always start with the same number of species (100), individuals per species (2) and keep the same number of iterations. What happens if you increase the number of individuals per species?

## Making a More Realistic Metacommunity

An infinite repository of species does not seem to be a very realistic assumption. What if we substitute it by a large set of populations with the same dynamics as the community? We would then have two coupled systems, each with its own stochastic dynamic for births and deaths.

However, if the metacommunity also follows the same zero-sum stochastic dynamics, it will also lose species with time. How can we solve this? First, we can think of the metacommunity as being much larger than the community, representing the regional pool of colonizers. We can start with the very humble assumption that the metacommunity has twice as many species with ten times more individuals than the community.

Use the function without migration just to remember the effect of the community size over the species erosion.

S = 100
cycle = 20.000
j = 2 e 20

It is possible to see that even moderate sizes for the metacommunity allow for a slower species erosion. Thus, a generation of species at a very slow rate would be able to balance the extinctions. If this rate is slow enough to be comparable to the time necessary for the evolution of a new species, we have a solution: in the metacommunity, the loss of species to random extinctions is balanced by speciation, in evolutionary timescales!

Thus, we can define a speciation rate, $\nu$, that expresses the probability that a dead individual in the metacommunity will be replaced by an individual from a new species. This rate is extremely low, but is enough to keep, or even raise, the number of species in the metacommunity.

Let's see how it is done in EcoVirtual. Now, use the function simHub3.

Now we have parameters for the metacommunity as well:

Opion parameter definition
Number of Species (Metacommunity)Sm number of species in the metacommunity
Individuals per Species (Metacommunity)jm number of indivíduals per species in the metacommunity
Speciation ratenu speciation rate of the metacommunity
Migration ratem migration rate of the metacommunity

Using the sizes we have already determined for the community and metacommunity, investigate the effect of increasing the migration rate:

S = 100
j = 2
Sm = 200
jm = 20
nu 1e-9
m = 0 a 0,4 a intervalos de 0,1

Experiment also changing the size of the community and metacommunity, and changing the speciation rate.

Another idea is to increase the simulation time, to assess what is the long term dynamics of this system. To do this, increase the Final Time option, but remember that larger values will take a while to process. Have some patience and fix yourself a coffee.

The neutral model allows the calculation of a fundamental diversity number, called $\theta$ in the graphs. This is a measure of the biodiversity in the metacommunity (corresponding to Fisher's regional alpha, a classic diversity index based on the logseries distribution), and is related to the speciation rate and the size of the metacommunity.

## Questions

* In the ecological time scale, does this metacommunity behave very differently from the fixed and infinite metacommunity from the last simulation? * What is the effect of increasing the speciation rate in the metacommunity? * What happens if the metacommunity is too small?

#### Introduction

* Cassemiro, F.A.S. & Padial, A.A. 2008. Teoria Neutra da Biodiversidade: aspectos teóricos, impacto na literatura e perspectivas. Oecologia Brasiliensis, 12 (4): 706-719. * Alonso, D., R. S. Etienne, and A. J. Mckane 2006. The merits of neutral theory. Trends in Ecology & Evolution 21: 451-457. * Hankin, R. 2007. Introducing untb, an R Package For Simulating Ecological Drift Under the Unified Neutral Theory of Biodiversity. Journal of Statistical Software 22: 12 http://www.jstatsoft.org/v22/i12/. An R package to simulate and fit species abundance distributions as predicted by the neutral theory (the package introduction is an excellent review of the theory!)