News from the Computational Ecology Lab


Modelling Coffee: Noise-induced effects in collective dynamics

Marco Fele
24 January 2024

In this tutorial, Marco explains how to implement the main routines to replicate the effects of the paper on Noise-induced effects in collective dynamics and inferring local interactions from data

poster header

Part 1 Gillespie algorithm

The code contains a function for exactly simulating runs from the master equation through the Gillespie algorithm. The Gillespie algorithm is divided in four main parts:

1.- Find the velocity (or propensity) for every reaction. This is done by multiplying the reaction rate (which is conditioned on the reagents encountering each other) with the rate that the reagents do encounter each other. The rate that two reagents encounter each other can be found through the mass action assumption. Usually this is done simply by multiplying the concentration of the reagents, but this is an approximation that holds only for big population sizes because reagents do not interact with themselves, and the concentration of the species with and without one molecule can be quite different in small population sizes and omega. Hence it is possible to use the stochastic law of mass action, equal for one reaction to $ k \Omega \prod \frac{x_i!}{(x_i-1)! \Omega^{s_i}} $ (for details see David Schnoerr et al (2017) J. Phys. A: Math. Theor. 50, 093001). Since there are some factorials, it is hard to compute in practice, and has been rearranged in the code implementation.

2.- Find the waiting time before the next reaction occurs by sampling from an exponential distribution with mean rate equal to the sum of the reaction velocities.

3.- Find the reaction that happens by choosing from the possible reactions with a probability proportional to the reaction velocity.

4.- Update the states based on the reaction that happened.

The function has not been optimized but works for simulating every type of system starting from the microscopic reactions. It performs only one update and must be inserted inside a for loop for producing the entire simulation. As input, it requires:

1.- The current number of molecules/individuals in a specific state through a vector of size equal to the number of possible states and each entry the number of individuals in that state.

2.- A vector containing the reaction rates.

3.- A matrix indicating the stoichiometry of the reagents, with the number of rows equal to the number of reactions, and number of columns equal to the number of possible states, and entries equal to the number of species of that state that must encounter to produce the specific reaction.

4.- A matrix indicating the stoichiometry of the products, with the number of rows equal to the number of reactions, and number of columns equal to the number of possible states, and entries equal to the number of species of that state that are produced from that specific reaction.

5.- A parameter omega indicating the spatial scale of the system.

As output, it gives a vector containing the waiting time, the number of the reaction the occurred, and the new number of individuals/molecules in each state.

It could be a good test to modify the code to simulate clonal logistic growth by using these reactions: A -> 0 with rate 0.05, A -> 2A with rate 0.2, 2A -> A with rate 0.05. You can start multiple replicates by having only one individual and set omega to 50.

Part 2 Replication of the results of the paper “Noise-induced effects in collective dynamics and inferring local interactions from data”

Jhawar J, Guttal V. (2020) Phil. Trans. R. Soc. B 375: 20190381. http://dx.doi.org/10.1098/rstb.2019.0381

The replication of the results consists of two parts, one applied to the voter model, and one applied to the higher order interactions model (see the paper for details). The only difference between the two is that the higher order interactions also has a reaction of the type 2A + B -> 3A, which leads to a non-linear per capita rate of change in the ordinary differential equation and consensus formation with multi-stability in the limit of infinite population size (not present in the voter model). For each model it is shown examples of the dynamics through 20 replicates of the time series obtained iterating the Gillespie algorithm and the probability density of the population being in certain states. Interestingly, also the voter model shows consensus and multi-stability! This is because of the constructive effect of intrinsic noise. To better understand this result, it is possible to fit a Langevin equation to the time series we have simulated and find the functional form of the deterministic (drift) and stochastic (diffusion) terms. Despite the Langevin equation being an approximation, it explicitly defines a term for stochasticity, enabling us to investigate noise, quite cool.

To fit the data, we first have to find the autocorrelation function for figuring out the best time scale (see paper for details).

\[ACF(\tau) = \frac{\langle (M(t) - \langle M(t) \rangle ) (M(t+\tau)- \langle M(t) \rangle) \rangle}{\langle (M(t) - \langle M(t) \rangle)^{2} \rangle }\]

When I see an equation my first though is “how do I calculate that?”. In my opinion Tidyverse has some cool operations which can be used to translate the equation into a specific value. For example, the averages in the ACF are calculated over different things, which can be captured by grouping.

The last part is to find the deterministic and stochastic component, which produce respectively the first and second moments (see paper for details). The first moment is the average “jump” from a specific population state. The second moment is the variance of such “jumps”. In this case there are only two possible individual states, only one degree of freedom to describe the state of the entire population, but in more complex cases a “jump” could be a vector in a multidimensional state space.

Comparing the two models we see that the deterministic component “pushes” the population towards non-consensus in the voter model (equal number of individuals for both options), while there are two stable equilibria separated by and unstable equilibrium in the higher interaction model (equilibria are found when the “push” is equal to zero, and equilibria are stable when the “push” goes towards the equilibrium). For both models the noise is stronger when the population is undecided because there is more uncertainty in the reactions that can occur (the reactions have similar velocities), which is the definition of intrinsic noise. Hence, the voter model is pushed away from its non-consensus equilibrium condition, leading to noise induced consensus. Noise constructs order!

Marco has kindly share his code with us here.


Modelling Coffee: Gentle introduction to stochastic calculus for population dynamics

Miguel Lurgi
11 January 2024

This Friday 12th of January, we resume our activities of the modelling coffee, continuing a tutorial presentation about stochastic calculus, Gentle introduction to stochastic calculus for population dynamics, by Gui Araujo.

The topics of this week are differential equation models, such as Fokker-Planck and Langevin equations, and a discussion on the concept of noise and the differences between intrinsic and extrinsic noise.

poster header


Lucie represented the lab @ BES Annual Meeting

Miguel Lurgi
14 December 2023

poster header

This week Lucie travelled to Belfast to present her most recent findings on the effects of disturbances on meta food webs at the 2023 Annual Meeting of the British Ecological Society!

An excellent representation of the current research in our lab. It was very well received and Lucie got many interesting questions and comments.

poster picture


Abby's paper featured by Trends in Microbiology

Miguel Lurgi
08 December 2023

Great news! Abby’s paper on the effects of microbial community structure on coral larval settlement was featured as a Spotlight by Trends in Microbiology!

The original paper: Linking differences in microbial network structure with changes in coral larval settlement can be downloaded here!

microbial network


Dr Ricardo Martínez-García visits the lab

Miguel Lurgi
06 November 2023

This week, my good friend and colleague, Dr Ricardo Martínez-García, from the Centre for Advanced Systems Understanding in Germany, visits the lab!

He will be working with me on the theoretical modelling of territoriality-driven dispersal and will be around for interesting discussions!

About Ricardo:

Ricardo got his PhD in Physics from the Institute for Cross Disciplinary Physics and Complex Systems (IFISC, Spain) in 2014. After that completed a postdoctoral training at the Department of Ecology and Evolutionary Biology at Princeton University (USA) until 2019. Between 2019 and 2022 he was an Assistant Professor at the South American Institute for Fundamental Research and the Institute for Theoretical Physics of the State University of São Paulo (Brazil). Since December 2022 he is a Young Investigator Group Leader at the Center for Advanced Systems Understanding (CASUS; Görlitz, Germany) where he leads the Dynamics of Complex Living Systems research group.

His research seeks to understand and quantify how individuals behave in response to various interactions between them and with the environment, and how these behaviors drive community and ecosystem-level processes. Among those, he is particularly interested in emergent spatiotemporal patterns and their ecological and evolutionary implications. To answer these questions, he studies a variety of systems at various scales, from microbial communities to entire landscapes. For each of these, he develops mathematical models in which population-level processes result naturally from a detailed description of individual-level interactions and use them to investigate (eco)-system level processes that occur at the ecological and/or evolutionary scale. When possible, we test model predictions with experimental and field data. This approach ultimately allows us to use emergent population-level patterns as a bridge between individual behaviors and ecological and evolutionary scales.

He will present a couple of seminar at the Biosciences and the Maths Departments to share his research with us!

Bioscience: To leave or not to leave: a mechanistic model for the decision-making process behind ungulate partial migration

ungulates

ABSTRACT

Despite the importance of ungulate migrations, we lack a complete understanding of why some ungulates species migrate and some do not. Moreover, at the population level, some migrate and others remain behind as residents, a phenomenon known as partial migration. Even though progress has been made towards understanding long-term fitness benefits of partial migration, the underlying decision-making process that makes some individuals migrate and others remain within one single range remain unknown. In this presentation I will combine empirical data from three different migrant ungulate species and mathematical modeling to address this question. I will first show that, across these three ungulate species, the number of residents is unrelated to total population size, a pattern predicted by no previous modeling framework. Next, I will introduce a new model of ungulate partial migration wherein individuals probabilistically decide to start migrating based on the intensity of environmental and social cues. Within this modeling framework, residents arise for most parameter combinations and the number of residents is largely invariant with total population size. Therefore, this new model explains the ubiquity of residents in migratory ungulate populations and presents novel patterns to be tested with further data collection.

Maths: Population dynamics models with non-local spatial interactions: from spatial patterns to species coexistence

microbial-models

ABSTRACT

From microbial colonies to entire landscapes, biological systems often self-organize into regular spatial patterns, which might have significant ecological consequences. Several models have been proposed to explain the emergence of these patterns. Most of them rely on a Turing-like activation-inhibition scale-dependent feedback whereby interactions favoring growth dominate at short distances and inhibitory, competitive interactions dominate in the long-range. However, the importance of short-range positive interactions for pattern formation remains disputable. Alternative theories predict their emergence from long-range inhibition alone. In this presentation, I will explain how self-organized patterns might emerge in purely competitive models. I will first present in which conditions long-range competition alone can generate regular patterns of population density in systems with one and two species. Then, I will discuss the ecological implications of those patterns both for population persistence and species coexistence.