Description Usage Arguments Details Value Examples
View source: R/poisson_process_simulation.R
Simulates event times from a (one-dimensional, homogeneous) Poisson process
of rate λ per hour. The user has the options to simulate events
over a fixed time period of hours
hours or to simulate a fixed number
n_events
of events.
1 | poisson_process_sim(lambda = 1, hours = 24, n_events = NULL)
|
lambda |
A positive numeric scalar. The rate of the Poisson process. |
hours |
A positive integer scalar. The number of hours for which to simulate a Poisson process of rate lambda events per hour. |
n_events |
A positive integer scalar. The number of events to simulate. |
If n_events
is supplied then exactly n_events
are
simulated and hours
has no effect. If n_events
is not
supplied then events are simulated over the time interval
(0, hours
). If no events occur in (0, hours
) then
the value -1 is returned.
A numeric vector containing the (ordered, smallest to largest) times at which the events occur. The returned object has class "poisson_process".
1 2 3 4 5 | sim1 <- poisson_process_sim(lambda = 2, hours = 24)
plot(sim1)
sim2 <- poisson_process_sim(lambda = 2, n_events = 50)
plot(sim2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.