Inter-arrival gap sampled by inverse transform

Samples the gap to the next arrival in a homogeneous Poisson process by inverting the exponential distribution function. The function log is the natural logarithm. In a discrete event simulation the sampled gap is added to the current arrival time, S_n equal to S_(n-1) plus X, and the next arrival is placed on the event queue.

Signature

X = -log(U) / lambda
Inputs
InputsDefinitionUnit
URandom number drawn uniformly on the unit interval, excluding zero so that its logarithm existsnone
lambdaConstant arrival ratearrivals per unit of time, for example patients per hour
Output
XTime from one arrival to the nexttime, in the reciprocal of the unit of lambda, for example hours

Function

Arrival process count, gap and arrival-time function

Maps an arrival rate, constant or varying with time, to the number of patients or other entities that arrive in a window, the gaps between successive arrivals and the clock time of each arrival. The three descriptions carry the same information: S_n is the time of the nth arrival, X_i the gap before arrival i and N(t) the number of arrivals up to time t, in the notation of the Arrival Process article. The records cover Poisson counts, time-varying rates, sampling of gaps and arrival times in a discrete event simulation, and the single-server queueing result that links the arrival rate to waiting.

Try this function

Implementations

  • Excel

    Exponential arrival gap in one cell

    Excel RAND returns values from zero up to but not including 1, so 1 minus RAND is used to keep the logarithm finite. Rate is a named cell holding the arrival rate.

    =-LN(1-RAND())/Rate

Assumptions

  • Constant rate until the next arrival

    The gap is exponential only when the rate is constant from the current arrival to the next. With a time-varying rate the gaps are generated by thinning, using the acceptance probability on this page.

  • Fresh independent random number for each arrival gap

    Each gap uses a new uniform draw, independent of earlier draws, so the gaps are independent and the memoryless property holds.

Worked examples

  • Gap at 3 patients per hour with U of 0.5

    The article's example: at 3 patients per hour and a random number of 0.5, the gap is log 2 divided by 3, about 0.2310 hours or 13.9 minutes.

    U = 0.5; lambda = 3; X = 0.2310
  • Gap at 3 patients per hour with U of 0.9

    A random number of 0.9 at the same rate gives a gap of about 0.0351 hours, about 2.1 minutes. Draws near 1 give short gaps and draws near zero long ones, and the mean gap over many draws is 1 divided by lambda, 20 minutes here.

    U = 0.9; lambda = 3; X = 0.0351

Common errors

  • Multiplying by the arrival rate instead of dividing

    Writing the gap as minus log U times lambda treats the rate as a mean gap. At 3 patients per hour and U of 0.5 it gives about 2.08 hours instead of 0.231, so arrivals are generated nine times too slowly.

  • Constant-rate gaps for time-varying demand

    Sampling every gap at the daily average rate removes the daytime peak, so the simulation shows the congestion and cover cost of steady demand. A service with a peak needs a time-varying rate, for example generated by thinning.

Sources

  • Exponential interarrival times of a Poisson process

    Gallager RG. Discrete Stochastic Processes, course text for MIT 6.262, chapter 2 (Poisson processes). MIT OpenCourseWare; 2011. Definition 2.2.2: the interarrival intervals have the exponential distribution with density lambda exp(-lambda x), so the probability that a gap exceeds x is exp(-lambda x), which the formula inverts.

    View source →

Canonical Identity

Stable URI · Machine-readable · Resolvable · CC BY 4.0