Saturday, March 11, 2023

Generating a Poisson Process from Uniformly Distributed Pseudo-random Numbers

 

Most microprocessors generate pseudorandom numbers that follow a uniform distribution. This is great for simulating things like rolling dice where the probability of rolling a 1 is the same as rolling a 4. It turns out, however, that for most natural processes, the time between events is more accurately modeled using an exponential distribution of random numbers. This results in both more clustering of events and larger gaps in between them. These are called poisson processes because the distribution of events-per-time-interval follow a Poisson distribution. 

In both of the two samples below, there are twenty events per time interval. In the first sample, events are spaced using a uniform distribution of random numbers. In the second sample, events are spaced using an approximate exponential distribution (thereby generating a Poisson process). 


It’s a subtle difference, but the exponentially spaced events seem less regular—they occur both earlier and later than expected. The Poisson distribution has been fitted to a wide variety of natural events. Events as varied as radioactive decay/clicks on a Geiger counter, lightning strikes, and Prussian soldiers killed by kicking horses have all been described as Poisson processes. 

This default code for the Twitch-n-Howl board uses a mathematical transformation to convert the uniformly distributed pseudorandom numbers into exponentially distributed numbers.

where u is the uniformly distributed random number and lambda is the rate parameter (# of events per unit time)

This same transformation is depicted graphically below. The blue line shows a uniform distribution of random numbers, while the red line shows an exponential distribution of random numbers. Both distributions have the same mean and area under the curve. 

These exponentially distributed random numbers are used to determine spacing between events. One can see that using an exponential distribution of random numbers to determine event spacing would result in some events closer together and some events further apart than would be present using a uniform distribution of random numbers for event spacing. This is one of the properties of a Poisson process and helps explain why natural random events seem so unpredictable. 

No comments:

Post a Comment