Birth-Death

Consider the linear birth-death process presented in Section 1.3 of Stochastic Modelling for Systems Biology. The text introduces some differences between continuous, deterministic modelling and discrete, stochastic modelling. Let X(t) be the population of bacteria which reproduce at a rate of λ and die at a rate of μ. The continuous model of this process is the differential equation

X'(t) = (λ - μ) X(t), X(0) = x0

which has the solution

X(t) = x0 e(λ - μ)t.

We can numerically solve the continuous, deterministic model in Cain. Open the file examples/cain/BirthDeath.xml and select the Birth Death 0 1 model, which has parameter values λ = 0 and μ = 1. In the method list, clone the Direct method by selecting it and then clicking the clone button . Click twice (don't double-click) on the result and change its name to "Deterministic." In the method editor, select the Time Homogeneous and then the Time Series, Deterministic categories with the default method (ODE, Integrate Reactions) and options (Runge-Kutta, Cash-Karp).

Check that the species X has been selected in the recorder panel. In the launcher panel set the number of trajectories to 1 and click the launch button   to generate the solution. You can visualize the solution by clicking the plot button   in the output list to bring up the plotting configuraton window (shown below).

Add axes labels as shown above and then click the plot button. The population as a function of time is plotted below.

The ordinary differential equation (ODE) integration method in Cain actually solves a different formulation of the model than the population-based formulation above. for the method.) As the method name "ODE, Integrate Reactions" suggests, it integrates the reaction counts. Instead of combining the effect of the two reactions to formulate the problem in terms of the species population X, the birth reaction B and the death reaction D are each represented. The birth-death process can be modelled with the following set of differential equations:

B'(t) = λ X(t), B(0) = 0
D'(t) = μ X(t), D(0) = 0
X'(t) = B'(t) - D'(t), X(0) = x0

It is perhaps instructive to translate the equations into plain English.

For λ ≠ μ the system of equations has the solution

B(t) = λ x0 (1 - e(λ - μ)t) / (μ - λ)
D(t) = μ x0 (1 - e(λ - μ)t) / (μ - λ)
X(t) = x0 e(λ - μ)t.

While the population solutions are the same, the reaction-based formulation of the model carries more information than the population-based formulation. The population depends only on the difference λ - μ. However, the reaction counts depend on the two parameters separately. For λ = 0 and μ = 1 no birth reactions occur.

While the reaction counts are calculated, by default they are not recorded in the simulation output. Delete the solution that we generated previously by clicking the delete button   in the simulation output panel. Then select the reactions tab in the recorder panel and select both the birth and death reactions. Now run the simulation again. In the plotting window select the Cumulative reactions radio button, move the legend to the upper left corner, and change the Y axes label to "Reaction Counts."

Plotting will result in a figure like the one below.

For λ = 10 and μ = 11, the population is the same, but the reaction counts differ. Below is a plot of the reaction counts for this case.

Now consider the discrete stochastic model, which has reaction propensities instead of deterministic reaction rates. This model is composed of the birth reaction X → 2 X and the death reaction X → 0 which have propensities λX and μX, respectively. First we will generate a trajectory that records all of the reactions. Select the Birth Death 0 1 model. Then clone the "Deterministic" method (with the clone button ) and rename it "DirectAll." For this method select the Time Homogeneous and Time Series, All Reactions categories with the default method and options. Then generate a trajectory with the launch button. Below is a plot of the species populations. We see that the population changes by discrete amounts.

Below we use Cain to reproduce the results in the text that demonstrate how increasing λ + μ while holding λ - μ = -1 increases the volatility in the system. For each test, we generate an ensemble of five trajectories and plot these populations along with the deterministic solution. Note that hitting the "Plot" button in the plotting window adds to the current figure while "New plot" creates a new figure. Also note that you can click on the grid elements and columns in the plotting window to customize the appearance of the curves.


λ = 0, μ = 1


λ = 3, μ = 4


λ = 7, μ = 8


λ = 10, μ = 11

For a simple problem like this we can store and visualize all of the reactions. However, for more complicated models (or longer running times) generating a suite of trajectories may involve billions of reaction events. Storing, and particularly plotting, that much data could be time consuming or just impossible on your computer. Thus instead of storing all of the reaction events, one typically stores snapshots of the populations and reaction counts at set points in time. Again clone the "Deterministic" method and rename it to "Direct." For this method select the Time Homogeneous and Time Series, Uniform categories with the default method and options. In the reactions tab of the recorder panel select both reactions. For each test, we generate an ensemble of ten trajectories and plot the species populations and the cumulative reaction counts. Note that because we are only sampling the state, we don't see the same "noisiness" in the trajectories.



λ = 0, μ = 1



λ = 3, μ = 4



λ = 7, μ = 8



λ = 10, μ = 11

In the plotting window you may choose between a number of visualization options. First you choose what to plot:

Next you choose how to display the data: either plot the trajectories or plot their mean (and optionally their standard deviation). Thus there are six ways of generating a plot for a given simulation output. Below we show each of these for the birth-death model with λ = 3 and μ = 4.


Population Statistics


Population Trajectories


Binned Reaction Count Statistics


Binned Reaction Count Trajectories


Cumulative Reaction Count Statistics


Cumulative Reaction Count Trajectories

After selecting the plotting method you can customize the appearance by editing the table that lists the species or reactions. See the Plotting Time Series Data section of the Visualization and Analysis chapter for details.

Consider how the value of λ affects the population of X at time t = 2.5. From the plots above it appears that with increasing λ there is greater variance in the population, and also a greater likelihood of extinction (X = 0). However, it is not possible to quantify these observations by looking at trajectory plots. Recording histograms of the state is the right tool for this. Once more clone the "Deterministic" method. This time rename the result "Histogram." Select the Time Homogeneous and Histograms, Transient Behavior categories with the default solver method and options. Since we are only interested in the population at t = 2.5, we set the recording time to that value and set the number of frames to 1. We set the number of bins to 128 to obtain a high resolution histogram and launch a simulation with 100,000 trajectories for each value of λ. In the plotting window we switch to the histograms tab. When plotting histograms you choose the species and the frame (time). You can also choose colors and enter a title and axes labels if you like. The plot configuration window is shown below.

The histograms for each value of λ are shown below. We see that for λ = 0, the mode (most likely population) is 4, but for λ = 3, 7, or 10, the mode is 0. The likelihood of extinction increases with increasing λ.


λ = 0, μ = 1


λ = 3, μ = 4


λ = 7, μ = 8


λ = 10, μ = 11