nhpp.sim: Simulate non-homogeneous Poisson process(es)

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/poisson.R

Description

Get the n consecutive event times of a non-homogeneous poisson process. Events are simulated using an homogeneous process with rate, and an event at time t is admitted with probability prob.func(t). The rate parameter of an homogeneous process is often called lambda.

Usage

1
nhpp.sim(rate, num.events, prob.func, num.sims = 1, t0 = 0, prepend.t0 = T)

Arguments

rate

the rate at which events occur in the equivalent homogeneous Poisson process, aka lambda

num.events

number of event times to simulate in each process

prob.func

aka intensity function, function that takes time as sole argument and returns value between 0 and 1

num.sims

number of simulated paths to create

t0

the reference start time of all events

prepend.t0

T to include t0 at the start of the process

Details

This method is called 'thinning' by Lewis & Shedler (1978)

Value

a numeric vector of length num.events if num.sims=1 else, a num.events by num.sims matrix [num.events+1 is prepend.zero=T]

Author(s)

Kristian Brock - Author, Daniel Slade - Contributor

References

Lewis & Shedler, Simulation of Non-Homogeneous Poisson Processes by Thinning, 1978

See Also

nhpp.scenario, hpp.sim

Examples

1
2
3
4
intensity <- function(t) pmin(t/3, 1)
rate <- 10
num.events <- 100
nhpp.sim(rate, num.events, prob.func=intensity)

Example output

  [1]  0.0000000  0.3903268  0.7385991  1.3614356  1.9036205  1.9595628
  [7]  2.0305284  2.2695102  2.4661606  2.6544175  2.7654385  2.8462603
 [13]  2.8742454  3.0140468  3.0961351  3.1324025  3.1942818  3.2428672
 [19]  3.2930997  3.3107036  3.3648895  3.4709337  3.4856531  3.4975757
 [25]  3.5260086  3.5730166  3.6366508  3.6568116  3.6907542  3.9534699
 [31]  3.9854626  4.0069594  4.0981890  4.1127630  4.1398511  4.3769904
 [37]  4.4504324  4.4786975  4.8065323  5.2981086  5.6309221  5.7199119
 [43]  6.0369636  6.0484132  6.1475901  6.2487837  6.2547144  6.4040599
 [49]  6.6193207  6.8781829  7.0415981  7.1151278  7.3662932  7.4899143
 [55]  7.8685486  7.9455001  7.9960719  8.0431147  8.0863463  8.1185481
 [61]  8.1197285  8.3324506  8.4268655  8.4925437  8.5790005  8.6377350
 [67]  8.8268468  8.9051561  9.2715863  9.8404369 10.2180795 10.2877734
 [73] 10.3098870 10.3999983 10.4589512 10.4625304 10.6816266 10.8578402
 [79] 10.9181099 11.3387707 11.4963940 11.5032861 11.5705274 11.6035786
 [85] 11.6263903 11.6775202 11.7099414 11.7536011 11.8389191 11.8800551
 [91] 12.0250139 12.0804844 12.2375224 12.3883253 12.4875598 12.5008078
 [97] 12.6224953 12.6334215 12.6596800 12.8881555 12.9084954

poisson documentation built on May 2, 2019, 6:53 a.m.