lundi 29 mai 2017

How to bound the sample of Poisson Random Variates to simulate arrivals

I want to make a montecarlo simulation on which I generate 10 scenarios, each of them is characterized by a random number of arrivals in a time horizon.

I use the scipy.stats.poisson http://ift.tt/2qsJDSx to generate the samples of arrivals for each scenario, assuming that the mean is 12.

from scipy.stats import poisson
arrivals = poisson.rvs(12, 10)
print arrivals

The output is a list of random numbers:

[11 13  9 10  8  9 13 12 11 23] 

The mean is 11.9 which is good enough, but the problem is that in this case, in the last scenario there are 23 arrivals which is far from the mean 12.

Since before running this simulation I had to select a population, I have to make the size of that population large enough to comply with the Poisson Random Variates. So let's say that I select a population with size 1.5 * 12 = 18, unfortunately in the last scenario I will get an error since the sample is larger than the population itself.

My first question is: which is the minimum size of the population that I have to select in order to sample these arrivals with a list of Poisson Random Variates, without getting an error?

My second question is: is there a better way to manage this kind of problem by using another probabilistic distribution?

Please note that in this case mean=12 but I have to simulate other contexts on which mean=57 and mean=234.




Aucun commentaire:

Enregistrer un commentaire