Continuous models
💡 Previously on...
Last week we saw how to formalize (in the simplest possible way) our modeling choices in the form of difference equations. Thinking of a system's evolution in discrete time is generally easier, which helps to formalize it. Also, the finite resolution with which we observe or measure a system in reality makes data discrete and thus more promptly interpreted via a discrete-time formulation. However, a finite timestep allows multiple processes to occur simultaneously, and we showed how this can lead to incompatible events which, to be avoided, require us to force a certain temporal ordering.
We showed through an example how, thanks to infinitesimal timesteps allowing for only one event at a time, continuous-time models solve that problem by construction. In particular, we introduced Poisson processes, a basic type of stochastic process, essential to model systems in virtually any field.
📚 Week 4 readings
- 📖 Continuous-Time Models I-II - Modeling (Ch. 6-7 Sayama)*, but skip sections 7.3, 7.4 and 7.5
- 📖 Otto & Day (Box 2.6) contains a nice discussion on the relationship between discrete-time and continuous-time models
- 📖 Equilibria and Stability Analysis - One-Variable models (Otto & Day, Ch. 5) contains a nice discussion on the relationship between discrete-time and continuous-time models
- 📖 Primer 1: Functions and approximations (Otto & Day, pp.89-109) see P1.3 for the Taylor Series.
- 📖 Modeling Infectious Epidemics and Modeling Infectious Epidemics – SEIRS Model*
This week, we first show how to go from a discrete-time to a continuous-time formulation of a model, namely, from difference to differential equations. We will get used to continuous-time models by building and analyzing a few of them. We will then learn how to integrate differential equations in a computer and eventually how to simulate a dynamics unfolding in continuous time.
In the next clip, LHD shows how translate a discrete-time SIS model in continuous time.
Derived the continuous-time model, he next shows how to find the equilibria and determine their stability.
SIS and SI dynamics are pretty special nonlinear models, for they are simple enough to be solved exactly (specifically, we can find a closed expression for I(t) valid at all times; see Bonus content below). In most cases – and "most" is an euphemism here – we are not able to do it, and our only possibility to watch the modeled system evolving is integrating the equations numerically. In the next clip, LHD introduces two basic methods of numerical integration (Euler's and Heun's methods). In class, we will see how to implement such methods in Python.
Whether we want to explore the behavior of a stochastic system or test how well our model does in predicting that behavior, we need a way to simulate the dynamics. While in discrete time we know when any of the next events may occur – we only have to test whether or not it does –, in continuous time we have a continuous distribution of times at which the next event could take place. (This distribution exists also in discrete time, but it has a trivial form: a single peak at time
Things to do by Thursday at noon
Fast conversion from discrete to continuous
We have seen in the first clip how to go from a discrete-time description of the SIS model to its continuous-time counterpart. The procedure is the same for every model and in Sayama Ch. 6.3 you can find a general to connect the two. Here I want to show you an alternative way.
Consider the following generic equation for your discrete model,
where
(at rigor, that derivative should be indicated as a partial derivative, i.e.,
Taking the limit
In summary, given the function quantifying the state change in your discrete model, take its derivative with respect to
Solving the SI(S) model
Let us briefly rederive the equation for the SIS model in the well-mixing or mean-field approximation – it is a good exercise. We assume that each of the
Before going further, as an exercise, try to derive Equation (4) starting from the respective discrete model and applying Equation (3). Given the more general definition of the model considered here, notice that the exponent of
Back to Equation (4), rescaling
Notice that an SI dynamics is obtained by setting
Multuplying both sides by
We have already seen how to solve this (reminder: solve first the homogeneous equation with no constant term, then solve the full equation by letting the factor in front of the exponential you got to depend on time); we get the solution
From
First, notice that setting
Over time,
...
What if the system is exactly at the critical point
Proceeding as before, one obtains the solution
Therefore, the epidemic dies out also for
Transversality of simple models
Can you think of other cases than infectious diseases where the dynamics is "isomorphic" to the SI(S) model? A couple of them come straight to my mind: a word or a behavior diffusing in a society, or a species growing in an environment. Wait...what?! How phenomena such different among them can be represented by the same model? Well, it turns out, they are not that different. Looking closer, they are all examples of population growth. The population of people using a word or adopting a behavior, or the population of a species. Words and behaviors "reproduce" themselves by being copied from mind to mind, through learning and imitation; species reproduce in the usual biological sense. This kind of transversality is typical of simple models: Stripped of finer details, many systems appear formally equivalent. You often want sophisticated models to make quantitatively accurate predictions, but simple, idealized models allow you to appreciate general patterns, build intuition and understanding, and transfer knowledge between fields.
After all these words, it's time to see a concrete example of such transversality. Consider a species in an environment with limited resources. Let
with
Now, look again at Equation (8). Any bell ringing in your brain? If not, go back by a few paragraphs. Can you spot a similar equation? Substitute
known as logistic equation. Remember the name, because its discrete-time version we are going to see next week will probably surprise you!
You may ask at this point: what is the limited resource in the SIS model when used to represent contagions – spread of pathogens, words, behaviors? Well, susceptible individuals. These are finite in number and infected individuals "compete" to infect them – the more the people I infect, the less the people available for you to infect.
Reading between the (math) lines
The limited resources we made reference to do not show up in the equations. We just mentioned them to justify the presence of that quadratic term. They are hidden there and it is a good exercise to make them appear explicitly. To make the Verhulst model a bit more general, suppose we now have two species of abundances
If we think of the three abundances in terms of biomass (measured for instance as the mass of the present total organic carbon), we can directly compare them. Since the system is closed, the total biomass
It seems like the equations for the two species do not talk to each other, as also the diagram seems to suggest. Where is the competition we stated at the beginning then? Let's not rush. Let us express
Now read between the lines – Equations (11) have the same form of Equation (8), except for the extra term proportional to
Let us close this section by observing what does it mean in terms of closeness/openness of the system to reduce the number of equations. We already used the constraint
The flow coming out from the