The IMSL_RANDOM_NPP function generates pseudorandom numbers from a nonhomogeneous Poisson process.
This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.
Routine IMSL_RANDOM_NPP simulates a one-dimensional nonhomogeneous Poisson process with rate function theta in a fixed interval (tend - tbegin).
Let λ(t) be the rate function and t0 = Tbegin and t1 = Tend. Routine IMSL_RANDOM_NPP uses a method of thinning a nonhomogeneous Poisson process {N*(t), t ≥ t0} with rate function λ*(t) ≥ λ(t) in (t0, t1), where the number of events, N*, in the interval (t0, t1) has a Poisson distribution with parameter:
The function:
is called the integrated rate function. In IMSL_RANDOM_NPP, λ*(t) is taken to be a constant λ*(= Theta_Max) so that at time ti, the time of the next event ti + 1 is obtained by generating and cumulating exponential random numbers:
with parameter λ*, until for the first time:
where the uj,i are independent uniform random numbers between 0 and 1. This process is continued until the specified number of events, Neub, is realized or until the time, tend, is exceeded. This method is due to Lewis and Shedler (1979), who also review other methods. The most straightforward (and most efficient) method is by inverting the integrated rate function, but often this is not possible.
If Theta_Max is actually greater than the maximum of λ(t) in (t0, t1), the routine will work, but less efficiently. Also, if λ(t) varies greatly within the interval, the efficiency is reduced. In that case, it may be desirable to divide the time interval into subintervals within which the rate function is less variable. This is possible because the process is without memory.
If no time horizon arises naturally, tend must be set large enough to allow for the required number of events to be realized. Care must be taken, however, that Ftheta is defined over the entire interval.
After simulating a given number of events, the next event can be generated by setting Tbegin to the time of the last event (the sum of the elements in the result) and calling IMSL_RANDOM_NPP again. Cox and Lewis (1966) discuss modeling applications of nonhomogeneous Poisson processes.
Examples
Example 1
In this example, IMSL_RANDOM_NPP is used to generate the first five events in the time 0 to 20 (if that many events are realized) in a nonhomogeneous process with rate function:
λ (t) = 0.6342 e0.001427t
for 0 < t ≤ 20.
Since this is a monotonically increasing function of t, the minimum is at t = 0 and is 0.6342, and the maximum is at t = 20 and is 0.6342 e0.02854 = 0.652561.
.RUN
FUNCTION ftheta_npp, t
RETURN, .6342*exp(.001427*t)
END
randomopt, set=123457
neub = 5
tmax = .652561
tmin = .6342
tbegin=0
tend=20
r = IMSL_RANDOM_NPP(tbegin, tend, 'ftheta_npp', tmin, tmax, neub)
PM, r
0.0526598
0.407979
0.258399
0.0197666
0.167641
Syntax
Result = IMSL_RANDOM_NPP(Tbegin, Tend, Ftheta, Theta_Min, Theta_Max, Neub [, /DOUBLE])
Return Value
A one dimensional array containing the times to events. If the length of the result is less that Neub, the time tend is reached before Neub events are realized.
Arguments
Neub
Upper bound on the number of events to be generated. In order to be reasonably sure that the full process through time tend is generated, calculate Neub as Neub = X + 10.0 * SQRT(X), where X = Theta_Max * (Tend - Tbegin).
Ftheta
Scalar string specifying a user-supplied function to provide the value of the rate of the process as a function of time. This function accepts one argument and must be defined over the interval from tbegin to tend and must be nonnegative in that interval.
Tbegin
Lower endpoint of the time interval of the process. Tbegin must be nonnegative. Usually, Tbegin = 0.
Tend
Upper endpoint of the time interval of the process. Tend must be greater than Tbegin.
Theta_Max
Maximum value of the rate function Ftheta in the interval (Tbegin, Tend). If the actual maximum is unknown, set Theta_Max to a known upper bound of the maximum. The efficiency of IMSL_RANDOM_NPP is less the greater Theta_Max exceeds the true maximum.
theta_min
Minimum value of the rate function Ftheta() in the interval (Tbegin, Tend). If the actual minimum is unknown, set Theta_Min = 0.0.
Keywords
DOUBLE (optional)
If present and nonzero, double precision is used.
Version History
See Also
IMSL_RANDOM