When ecological complex rules are not distinguishable from chance


I am increasingly interested in measuring “chance” as an ecological process. In addition to improbable events with strong influence (e.g., the arrival of monkeys to the New World), at finer scales, the probabilistic view of ecology can help explain why complex systems emerge and are stable. This is some quick rambling to write down some half-baked ideas before I forget them. Proceed at your own risk.

Measuring chance

My first approach was looking on how people measure chance in other fields, for example, in board games. It looks like a common metric is the spread of ELO values. ELO is a robust metric to create rankings among players that compete among each other multiple times, without the need of having all players compete against each other.

The beauty of this is that a pure chance game will have a low spread of ELO values. In fact, we can create easily this expectation for a given number of players. This is our null model.

library(elo) 
#https://cran.r-project.org/web/packages/elo/vignettes/running_elos.html

#Create a set of 100 species that overall play 9999 games and assing a random probability of wining each game
null <- data.frame(sp1 = round(runif(n = 9999, 
min = 1, max = 100)),
                   sp2 = round(runif(n = 9999, 
min = 1, max = 100)),
                   performance_sp1 = rnorm(n = 9999, 
mean = 1, sd = 0.5),
                   performance_sp2 = rnorm(n = 9999, 
mean = 1, sd = 0.5))

#run elo rankings
er <- elo.run(score(performance_sp1, performance_sp2) ~ as.character(sp1) + as.character(sp2), data = null, k = 20)
hist(final.elos(er))

As we can see, from the initial 1500 ELO all species started with, some (by chance) end up winning more games than others, and the spread goes from 1400 to 1600. I am aware this null model can be enhanced, for example by simply using a Bernoulli draw with 0.5 probability of wining each game, but I think it works to make my point.

Let’s now create a game where skills are the only important thing. The species with higher skills will always win. The second species with higher skills wins all others but the first one, and so on.

#100 species over 9999 games
skil <- data.frame(sp1 = round(runif(n = 9999, 
min = 1, max = 100)),
                   sp2 = round(runif(n = 9999, 
min = 1, max = 100)))

#fix skill level
skil$performance_sp1 <- skil$sp1
skil$performance_sp2 <- skil$sp2

#run elos
er <- elo.run(score(performance_sp1, performance_sp2) ~ as.character(sp1) + as.character(sp2), 
              data = skil, k = 20)
hist(final.elos(er))

Now the spread goes from 800 to 2200. This is (probably) among the widest spread you expect for any set of games with no chance involved in it (pure skills). So, if we want to compare for a given game, how far it is from pure chance, we can use the sd() of these distributions.

#Create null
m_null <- rep(NA, 100)
sd_null <- rep(NA, 100)
for(i in 1:100){
  null <- data.frame(sp1 = round(runif(n = 999, 
min = 1, max = 30)),
                     sp2 = round(runif(n = 999, 
min = 1, max = 30)),
                     performance_sp1 = rnorm(n = 999, 
mean = 1, sd = 0.5),
                     performance_sp2 = rnorm(n = 999, 
mean = 1, sd = 0.5))
  er_null <- elo.run(score(performance_sp1, performance_sp2) ~ as.character(sp1) + as.character(sp2), data = null, k = 20)
  sd_null[i] <- sd(final.elos(er_null))
}

#A game with performance fixed
skil <- data.frame(sp1 = round(runif(n = 999, min = 1, max = 30)),
                   sp2 = round(runif(n = 999, min = 1, max = 30)))
skil$performance_sp1 <- skil$sp1
skil$performance_sp2 <- skil$sp2
er_skil <- elo.run(score(performance_sp1, performance_sp2) ~ as.character(sp1) + as.character(sp2), 
              data = skil, k = 20)
sd_skil <- sd(final.elos(er_skil))
#sd_skil #Repeated runs give sd very close to 200 depending on the game species pairing, but the differences are minimal.

hist(sd_null, xlim = c(1,250))
abline(v = sd_skil, col = "red")

And if we were to calculate Z-scores, or maybe other better measures of distance from observed to null, we would quantify how far away from the null expectation our pure skill game is.

What happens when performance depends on the context?

However, in nature, we often observe species A outcompeting species B in context X (e.g., high precipitation), but losing in context Y (e.g., low precipitation). This is not chance, but an ecological mechanism. Let’s consider two extreme situations where the hierarchies are reversed, depending on the context.

real <- data.frame(sp1 = round(runif(n = 999, min = 1, max = 30)),
                   sp2 = round(runif(n = 999, min = 1, max = 30)),
                   situation = round(runif(n = 999, 
min = 1, max = 2)))
situation_performance <- data.frame(species = 1:30,
                                    situation1sp1 = 1:30,
                                    situation1sp2 = 30:1,
                                    situation2sp1 = 30:1,
                                    situation2sp2 = 1:30)
real <- merge(real, situation_performance[,c(1,2,4)], by.x = "sp1", by.y = "species")
real <- merge(real, situation_performance[,c(1,3,5)], by.x = "sp2", by.y = "species")
real$performance1 <- ifelse(real$situation == 1, real$situation1sp1, real$situation2sp1)
real$performance2 <- ifelse(real$situation == 1, real$situation1sp2, real$situation2sp2)

er_real <- elo.run(score(performance1, performance2) ~ as.character(sp1) + as.character(sp2), 
              data = real, k = 20)
sd_real <- sd(final.elos(er_real))

hist(sd_null)
abline(v = sd_real, col = "red")

Our observed competition is not differentiable from chance. This is an extreme scenario, but a single change in the dominance hierarchies makes a deterministic mechanism indistinguishable from chance.

I find this quite interesting. In nature, we have plenty of situations where interactions among species depend on the context. For example, some species have good years when it rains plenty, others when it is dry. Some species win in open habitats, others in closed ones. All this variability breaks the hierarchies, making understanding coexistence similar to a game of chance.

But ecology does not work like board games…

I know, species (or populations (or even individuals)) do not win/lose, but there are already tools to calculate ELO quantitatively from differences in performance. Also, species do not compete only in pairs, but again, there are options to measure ELO in games with > 2 players.

Conclusions?

I am not sure where this is going. I am probably just reinventing the wheel. Gause already proved that coexistence was possible among paramecia only as long as conditions fluctuated. On the other hand, is very nice to see how deterministic mechanisms can be compatible with the neutral hypothesis (which is probably also something known?).

At the end I was not able to measure chance, but this is research, you know where do you start, but not where you will end up.

2 thoughts on “When ecological complex rules are not distinguishable from chance

  1. I would think about using the Bradley-Terry model here, an actual statistical model (which elo isn’t), and then you get a likelihood ratio test of chance vs the fit is better than chance. I suspect the results would be similar, however.

    Your last point, about an unmodelled effect making it look as if the only thing there is chance, is also the sort of thing that can show up in regression if an important explanatory variable is omitted from the model. The extra issue in your case is that the actual effect is hard to actually observe, unless you know it is precipitation (say) that makes the difference.

    • Thanks, I like the B-T model, I did not came across this before. And yes, my line of thought is that in ecology many variables might alter the hierarchies but you rarely can measure them.

Discussion