0

In Matlab, I want generate events that follow Poisson arrivals and the inter-arrival time between events to be exponentially distributed?

Which command should I use ?

SecretAgentMan
  • 2,690
  • 6
  • 16
  • 35
aziz
  • 17
  • 3

2 Answers2

3

Suppose you have a counting process, {N(t),t >= 0}, where N(t) is the number of events to occur by t.

If these events follow a Poisson Process (PP) with rate lambda then there are a host of properties we get for free. This posts assumes a homogeneous (or stationary) PP. See here and here and here for the time-dependent case.

Interevent times from a PP are Exponentially distributed with rate lambda.

Approach 1:
1. Generate interevent times
2. Obtain actual event times <---what you're wanting

Rate = 0.75;        % lambda   (events per unit time)
NumEvents = 20;     % number of events to generate

% Approach 1a         requires exprnd function
InterEventTimes = exprnd(1/Rate,NumEvents,1);
EventTimes = cumsum(InterEventTimes);

% Approach 1b         using inverse transform of exponential distribution
fh =@(n) - log(rand(n,1) / Rate;    % inverse transform of exponential distribution
InterEventTimes2 = fh(NumEvents);
EventTimes2 = cumsum(InterEventTimes2);

Validation for both of these approaches is available here.

SecretAgentMan
  • 2,690
  • 6
  • 16
  • 35
0

I am not sure whether there is a function, or that I am understanding the question correctly.

The formula for event times of a Poisson process is

tau=1/lambda*ln(1/r)

where lambda is the intensity of the process and r is a unit uniform distribution, such as the one produced by rand.

crown42
  • 307
  • 1
  • 7
  • That would be the formula for **inter**-event times, and the builtin function should generally be used rather than rolling your own. – pjs Jul 30 '17 at 16:16
  • @pjs, if the `exprnd` function isn't available, using the inverse transform of the Exponential would be a good start. Then `cumsum` would give the event times. – SecretAgentMan Dec 24 '18 at 16:07
  • @SecretAgentMan Using an exponential distribution, whether you use a built-in or roll your own with inversion, gives the times *between* events for a Poisson. The answer claims the inversion is the formula for event times, which is incorrect. – pjs Dec 24 '18 at 16:57
  • @pjs, I don't dispute that. See my answer to verify. My comment was implying that it is ok to use the inverse transform of the Exponential to get the interevent times. From these, `cumsum` gives the event times. I think we're violently agreeing here. Merry Christmas. – SecretAgentMan Dec 24 '18 at 17:04