Simulating Poisson processes using Google Sheets
How can we simulate Poisson processes on a computer or on Google Sheets?
Theory
Consider a Poisson process \(\{N(t)\}\). Given some parameter \(\lambda > 0\), we have the probability distribution given by
\[p_n(t) = \Pr(N(t) = n) = \frac{(\lambda t)^n e^{-\lambda t}}{n!}.\]
We assume that \(N(0) = 0\) almost surely. The value of \(N(t)\) increases by 1 over random periods of time. Let \(T_n\) denote the time at which \(N(t)\) becomes \(n\). Then, \(T_1, T_2, \cdots, T_n, \cdots\) are random variables. Next, let's define \(Q_n = T_n - T_{n-1}\). Of course, we assume \(T_0 = 0\); accordingly, \(Q_1 = T_1\). Since the Poisson process is a Markov process, \(Q_1, Q_2, \cdots, \) are i.i.d. (independent and identically distributed). Let's calculate the cumulative distribution function of \(Q_1 = T_1\).
\[\begin{eqnarray} \Pr(T_1 \leq t) &=& \Pr(N(t) \geq 1)\\ &=& p_1(t) + p_2(t) + \cdots\\ &=& 1 - p_0(t) \\ &=& 1 - e^{-\lambda t}. \end{eqnarray}\]
Thus, the density function \(\rho_{T_1}(t)\)of \(T_1\) is given by
\[\rho_{T_1}(t) = \frac{d\Pr(T_1 \leq t)}{dt} = \lambda e^{-\lambda t}.\]
This is the density function of the exponential distribution with parameter \(\lambda\). Thus, \(Q_1, Q_2, \cdots\) all follow the same exponential distribution with parameter \(\lambda\).
Simulation
- Generate a uniform random number \(r \in [0, 1)\).
- If \(r < 1 - e^{-\lambda \delta t}\), then increment by 1. Otherwise, do not increment.
- Set \(N(0) = 0\), k = 0.
- Generate a uniform random number \(r \in [0, 1)\).
- If \(r < 1 - e^{-\lambda \delta t}\), then set \(N((k+1)\delta t) = N(k\delta t) + 1\); otherwise, set \(N((k+1)\delta t) = N(k\delta t)\).
- Set \(k = k + 1\). Go to step 2, and repeat.
Comments
Post a Comment