Solution: Simulating a Poisson process
Eksempel
Here we solve the problem linking to this page. We simulate the processes in R.
Solution
Recall that if \(N(t)\) is a homogeneous Poisson process with intensity \(\lambda\), the waiting times between events are independent and exponentially distributed with rate \(\lambda\). Thus, to simulate \(N(t)\) we can sample from the exponential distribution, adding the resulting waiting times together to find the event times. Code 1 shows a simple script that does this in R, and plots the sample path together with the compensator \(N^*(t)\) and also the corresponding path of \(M(t) = N(t) - N^*(t)\) in a separate plot.
Figure 1 shows the resulting figures.
Code 2 shows code that adds a plot of the sample path of \(M^2(t)\) together with \(\lambda t\), and a plot of the sample path of \(M^2(t)-\lambda t\).
Figure 2 shows these plots.