# Conflicting demands - Tutorial in R

To create a model where there exists a conflicting demand (tradeoff) between colonization and competition in a multi-species system, we must first create a scenario where there is a variation in the ability of colonization / competition of the species.

For this we will create a system where the competitive ability is inversely related to colonization ability, a classic example of tradeoff.

At equilibrium, or at low disorder intensities, our virtual community would have its best competitor with a higher proportion of occupied patches, as in the coexistence of two species model. We will establish that this proportion is 20% occupied patches. Then, we establish a hierarchical ordered sequence where the next best competitor will occupy 20% of the remaining patches and the next 20% of what's left, etc, up to our last species (worst competitor) which will occupy a fraction of 20% of those last patches not occupied by any other species.

In that case, we would have the following scenario in the abundance distribution of our species:

$$f_{sp_i}=f_{sp1}(1-f_{sp1})^{i-1}$$

where:

$_i$ = position in the abundance rank in the community;

$f_{sp_i}$ = proportion of patches occupied by the i-st most abundant species

$f_{sp1}$ = proportion of patches occupied by the most abundand species (dominant).

Researcher David Tilman showed that this abundance distribution scenario is possible when all species experience the same rate of extinction / mortality and when the colonization rate of each species is given by:

$$c_i= \frac{pe}{(1-f_{sp1})^{2i-1}}$$

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.

First, open R and let's make a graph of this scenario of abundances for 10 species with the proportion of occupied patches for the best competitor in 20%:

x11() # open a window for the graph
s=10 # number of species in the begining of the simulation
i=1:s # position of the species in competition
i
d=0.2 # number of occupied patches for the best competitor species
p=d*(1-d)^(i-1) # Proportion of occupied patches for each species in equilibrium
p
plot(i, p, type="b", ylab="Proportion of occupied patches", xlab="Species rank")

Let's add the colonization rates in our graph, calculating for a constant extinction rate in 0.04 for all species:

pe=0.04
c= pe/(1-d)^(2*i-1)
c
par(mfrow=c(1,2))
plot(i, p, type="b", ylab="Proportional abundancees", xlab="Species rank")
plot(i, c, type="b", col="red", ylab="Colonization rate", xlab="Species rank" ) 

This is our equilibrium,a geometric distribution of abundances with the most abundant species with 20% and an extinction rate of 4% for all species.

## The model

Tilman again generalized the equation of propotions of occupied patches in time to n species:

$$\frac{df_{sp_i}}{dt} = c_if_{sp_i}(1-\sum_{j=1}^{i}f_{sp_j}) - pe_if_{sp_i} - (\sum_{j=1}^{i-1}c_jf_{sp_j}f_{sp_i})$$

Where:

$\frac{df_{sp_i}}{dt}$: variation in the proportion of occupied patches for species i;

$pe_i$: extincition probability 1) of species i in a patch;

Try to understand what each part of the equation means, the basics is:

The variation in the proportion of occupied patches by a species in abundance position i in the community, in a very short period of time equals to

• the empty patches colonized by species i,
• less the patches where there was extinction of species i,
• less the occupied patches where the better competitor 2) arrived.

Let's assemble this community, simulating it's dynamics over time! Our function performs the following steps:

- creates the species ranks

1. calculates the colonization coefficients as above
2. if fi (proportion of patches occupied at start) is a single value, fills this proportion of patches with (s) species, randomly drawn
3. if fi is a vector with s values, fills the patches according to this vector. This process is related to the species rank, starting from the best competitor to the worst
4. run simulation cycles up to tmax
5. at every cycle, calculates the extinction and colonization for each species, respecting its position in the competition hierarchy to determine whether it is dislodged from a patch or stays
6. stores the proportion of patches occupied by each species at every cycle
7. draws a graph and returns the simulation results

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.

Utilize a função comCompete do pacote EcoVirtual no R.

### Simulation parameters

Option parameter definition
data set R object to store the results
Maximum time tmax maximum number of simulations
columns cl number of columns of habitat in the landscape
rows rw number of rows of habitat in the landscape
INITIAL PARAMETERS
Occupied patches fi proportion of occupied patches in the beginning by all species
Number of Species S starting number of species
Moratality rate pe extinction probability per patch or mortality
Best Competitor Abundance (sp1)fsp1 proportion of occupied patches by the best competitor in equilibrium
DISTURBANCE PARAMETERS
Frequency fr if frequency = 1, there will be disturbances in all steps
Intensity int if intensity = 1, all patches will be affected by disturbance

## Testing the model

Let's test this model with 10 species (S=10), 10000 patches (cl = 20, rw= 100 ), with the best competitor expected to occupy 20% of the patches (fsp1) and the extinction probability pe=0.04. Let's run the simulation for 200 time steps (tmax) and do not change disturbance parameters (fr = 0 e int = 0). Let's start with a low proportion of occupied patches (fi=0.1), to simulate a situation where the system is far from equilibrium.

tmax= 200
cl=20
rw=20
fi=0,1
fsp1=0,2
pe=0,04
S=10
fr=0
int=0
1. Now, uses tmax=1000. Is there any difference in the interpretations? Go back with tmax=100.
2. Increase the number of patches to cl=100; rw=100. What is the difference? Explain it.
3. Increase the number of occupied patches in the beginning to 50% (fi=0,5).

To increase tmax and the number of pachtes will slow down the simulations, be patient!

As we can see, the number of patches in the simulation, together with the occupied patches in the beginning, is related to the stochastic extinction of species. Let's keep these parameters high (cl=100, rw=100, fi=1) to avoid loosing many species. As the system takes time to stabilize, we will keep the tmax parameter also high (tmax =1000).

• What is the interpretation of this result in terms of:
2. species substitution
3. ecological succession

## Including disturbance

We will now simulate a system with disturbances. In metapopulation models, we have seen that the probability of extinction ($p_e$) could be interpreted as a disturbance, or as part of the patches being affected and made available for subsequent colonization. Here, we interpret $p_e$ as the baseline mortality of the population, not as a disorder. This probability of death is constant and equal for all species in our model, only to simplify the simulation. We will create disturbances in our community, happening with some frequency intervals (fr) and a certain intensity (int) related to the proportion of affected spots.

Let's keep the other parameters constant and change only the disturbance ones:

tmax=1000,
cl=100,
rw=100,
S=10,
fi=1.0,
fsp1=0.2
pe=0.01,

### Applying disturbance

1. run the simulation without disturbance as a “control” for the disturbance experiment
2. predict what is expected to happen with the system when increasing disturbance
3. keep disturbance intensity in 10% of the patches (int = 0.1) and increase the disturbance frequency (0,01 ; 0,15; 0,25; 0,4; 0,5 até 1)
4. now, keep disturbance frequency constant in 10% of times (fr=0.1) and change the intensity (0,05; 0,1; 0,2; 0,3; 0,6; 0,8;…)
5. evaluate if your results agree with your predictions. Is there any discordance? Could you find an alternative explanation?
1. In which situations do the best competitors perform best?
2. And the worse competitors?
3. Can you see any pattern for the coexistence of species with this simulations?

### Intermediate disturbance

The intermediate disturbance hypothesis is generally credited to the researcher Joseph Connell (1978), although it was proposed by J. Phillip Grime a few years earlier in 1973, trying to explain competitive exclusion in plants. The work by Connell (see reference) may have had more prominence due to it having contrasted two very different environments, admittedly among the most diverse on the planet (tropical forests and coral reefs). In the original paper the researcher argues that the main factor related to the maintenance of high diversity in this ecosystem is the presence of disturbances in intermediate frequency and intermediate intensity.

Make some simulations to test this theory.

Tips

Save each simulation with a different object name. In the examples above we did that by calling each simulation by a name (test1, test2 …) to the right hand of the ← symbol, see below:
teste5 <- com.compete(tf=1000,l=100,c=100, s=10, fi=0.2, d=0.2, pe=0.04, fr=10, int=0.2)

This way, the result of the simulation is saved on different objects and we can then use these results. For example, we may be interested in seeing what the most abundant species is at the end of the simulation, for example in the last 10 cycles:

tf5=dim(teste5)[2]
teste5[,(tf5-10):tf5]

We can also count the number of species over time, as:

apply(teste2>0, 2, sum)

If you want to perform any other operation with the simulated data, contact the teacher.