Simulating birth-death processes



The birth-death process {N(t)} with birth and death rates λ and μ, respectively, and initial population size N(0)=n0 is characterized by the following differential-difference equations for the probability mass functions pn(t)=Pr(N(t)=n):

dp0(t)dt=μp1(t),(Eq:BDn)dpn(t)dt=λ(n1)pn1(t)(λ+μ)npn(t)+μ(n+1)pn+1(t),  (n1).

with the initial condition

pn(0)=δn,n0.

See Combining birth and death processes for the detail of how to analytically solve the above differential-difference equations. Here, we show how to simulate this process numerically as we did for the birth process and death process; See also:

First, we discretize the time steps with some small interval δt: N(0),N(δt),N(2δt),N(3δt),,N(kδt),

Next, we exploit the Markov property of the birth-death process: Every birth or death is the first birth or death since the last one. That is, given N(τ)=nτ at time t=τ, we may regard this as the "initial" condition for the next step: N(τ+δt)=nτ or nτ+1 or nτ1

Unlike the simple birth or death process, we have three mutually disjoint events. That is, we assume that during the short period δt, one of the following occurs: one birth N(τ+δt)=nτ+1, one death N(τ+δt)=nτ1, or nothing N(τ+δt)=nτ. Thus, we have the following differential-difference equations with pn(τ)=δn,nτ
dpnτ1(t)dt=μnτpnτ(t),dpnτ(t)dt=(λ+μ)nτpnτ(t),dpnτ+1(t)dt=λnτpnτ(t).
Solving these, we have
pnτ1(τ+δt)=μλ+μ(1e(λ+μ)nτδt)pnτ(τ+δt)=e(λ+μ)nτδt,pnτ+1(τ+δt)=λλ+μ(1e(λ+μ)nτδt).
Note that pnτ1(τ+δt)+pnτ(τ+δt)+pnτ+1(τ+δt)=1. 

Based on this, we have the following algorithm for simulating the birth-death process:
  1. Set N(0)=n0; set k=0.
  2. Generate a uniformly distributed random number r[0,1).
    1. If r<μλ+μ(1e(λ+μ)N(kδt)δt), then N((k+1)δt)=N(kδt)1;
    2. Otherwise, if r<1e(λ+μ)N(kδt)δt, then N((k+1)δt)=N(kδt)+1;
    3. Otherwise, N((k+1)δt)=N(kδt).
  3. Update k:=k+1, go to Step 2, and repeat.
A sample path obtained from such simulations is shown below:
A sample path of a birth-death process with birth rate λ=0.1 and death rate μ=0.09.


Comments

Popular posts from this blog

Birth process

Branching processes: Mean and variance

Informal introduction to formal logic