Mathematical description#
In the previous chapter, compartmental models were introduced in terms of compartments, transitions and events. This model structure exists without the need to commit to any particular method of simulation.
Now, we introduce mathematical objects that represent these concepts which allow for two ways to find solutions:
Continuous-Time Markov Chains (CTMCs), which model the stochastic occurrence of individual events.
Ordinary Differential Equations (ODEs), which describe the average behaviour of those events.
For illustration, we continue to use the extended SIR model (with births and deaths) introduced previously:
State vector#
We start with the state vector, \(\boldsymbol{y}\), describing the populations of the different compartments.
For the extended SIR model:
State change matrix#
Consider an event, \(j\). When it occurs, the state vector changes as:
where \(\boldsymbol{v}_j\) is the state-change vector associated with that event. For example, the infection event (which we’ll say is the event with index 1) has a state change vector:
Note that the state-change vector represents the combined effect of all transitions associated with the event. Collecting the state-change vectors for all events yields the state-change matrix (or stoichiometry matrix)
where \(N_E\) is the total number of events. The element \(\mathcal{D}_{ij}\) gives the change in compartment \(i\) caused by an occurance of the event \(j\).
For the extended SIR model:
where the columns refer to state change vectors for infection, recovery, births, S deaths, I deaths and R deaths respectively.
Event-Rate Vector#
Each event occurs at some rate \(\lambda_j\) and these rates are collected into the event-rate vector
In the SIR model:
The state vector \(\boldsymbol{y}\), state-change matrix \(\mathcal{D}\), and event-rate vector \(\boldsymbol{\lambda}\) together define a compartmental model in PyGOM. We now introduce the two related, but distinct, ways a compartmental model can be solved.
Continuous Time Markov Chains#
This event-based formalism follows closely from the mathematical description just outlined. Here:
State variables represent discrete counts
Events cause discrete jumps in the system state
The system evolves through the random occurance of events. Events occur according to their associated rates and thus their waiting times are exponentially distributed. The model evolves as a sequence of random jumps between states.
CTMCs are particularly useful when:
Population sizes are small
Stochastic effects are important
Extinction events are possible
Variability between realisations is of interest
Ordinary Differential Equations#
The ODE description is often viewed as a large-population approximation to the underlying CTMC. This interpretation departs from previous approach in that:
State variables are continuous
Events contribute through continuous flows
The system advances, not due to random occurrences of individual events, but continuously in time through the average effect of all events. Using matrix multiplication to sum over all events:
Applying this to the extended SIR model:
This approximation is often appropriate when populations are sufficiently large that random fluctuations are relatively unimportant.
Warning
The ODE solution should not generally be interpreted as the mean of a collection of CTMC realisations. For example, in an epidemic system where a substantial fraction of the realisations go extinct, the ODE solution will closely resemble the trajectories which grow, not reflecting an average of growing and extinct outcomes.
Summary#
The same compartmental model may be interpreted in two different ways.
CTMC |
ODE |
|---|---|
Discrete state variables |
Continuous state variables |
Stochastic |
Deterministic |
Events occur individually |
Events contribute through their average effect |
Stepped state trajectories |
Smooth state trajectories |
Variability between different realisations |
Same result every time |