Neil's News

Poisson Simulator

30 December 2024

Poisson distributions appear when events occur randomly, with a uniform probability over time, without a connection to each other. An example is meteors hitting the Earth. They may average four per century, but if one hits this morning, that doesn't affect the chances of another one hitting this afternoon. In such a scenario any given century might have 0 hits, rising in likelihood to 4 hits, and declining in likelihood as one approaches infinite hits.

Here's a simulator for generating a Poisson distribution.

Total number of events:

Average events per time period (λ):

The total time range for this simulation is the total number of events divided by the average events per time period (λ):

Here's a simulation of the cumulative number of events over the total time range:

Given the above simulation, here are the number of events which occurred for each time period:

The Poisson distribution appears when one counts the number of time periods with 0 events, 1 event, and so on. This histogram should produce a distinctive curve. The bars plot the actual values based on the earlier simulation. The line plots the mathematically expected values:

The formula for calculating the above expected curve is λk * e / k! where λ is the average events per time period, k is the number of events in a time period (0, 1, 2, ...), and e is 2.71828... This yields a probability between 0.0 and 1.0 for k number of events occurring in a time period. In the above graph this probability is multiplied by the total number of events to obtain the expected number of time periods with k events.

< Previous | Next >

 
-------------------------------------
Legal yada yada: My views do not necessarily represent those of my employer or my goldfish.