Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulating Poisson Waiting Times

Tags:

java

poisson

I need to simulate Poisson wait times. I've found many examples of simulating the number of arrivals, but I need to simulate the wait time for one arrival, given an average wait time.

I keep finding code like this:

public int getPoisson(double lambda) 
{   
    double L = Math.exp(-lambda);   
    double p = 1.0;   
    int k = 0;   

    do 
    {    
        k++;     
        p *= rand.nextDouble(); 
        p *= Math.random(); 
    } while (p > L);   

    return k - 1; 
} 

but that is for number of arrivals, not arrival times.

Efficieny is preferred to accuracy, more because of power consumption than time. The language I am working in is Java, and it would be best if the algorithm only used methods available in the Random class, but this is not required.

like image 306
Alex Avatar asked Jun 29 '11 21:06

Alex


People also ask

How do you simulate Poisson arrival?

Simulating a Poisson process For the given average incidence rate λ, use the inverse-CDF technique to generate inter-arrival times. Generate actual arrival times by constructing a running-sum of the interval arrival times.

How are the wait times of a Poisson process distributed?

Therefore, for a Poisson process, the waiting time for the first arrival/event is exponentially distributed. This is consistent with the idea that both the Poisson process and exponential processes are memoryless distributions.

What is Poisson process in simulation?

The Poisson process is a random process which counts the number of random events that have occurred up to some point t in time. The random events must be independent of each other and occur with a fixed average rate.

How do you know if something is a Poisson process?

Poisson Process CriteriaEvents are independent of each other. The occurrence of one event does not affect the probability another event will occur. The average rate (events per time period) is constant. Two events cannot occur at the same time.


1 Answers

Time between arrivals is an exponential distribution, and you can generate a random variable X~exp(lambda) with the formula:

-ln(U)/lambda` (where U~Uniform[0,1]). 

More info on generating exponential variable.

Note that time between arrival also matches time until first arrival, because exponential distribution is memoryless.

like image 71
amit Avatar answered Nov 06 '22 14:11

amit