Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Luis A. Afonso
Posts:
4,743
From:
LIsbon (Portugal)
Registered:
2/16/05


How to simulate a Poisson sample?
Posted:
Oct 5, 2013 4:50 AM


How to simulate a Poisson sample?
The discrete r.v. is said to have a Poisson Distribution with a positive real parameter lambda if the probability mass function is
P(X=x) = = 1/x! * [exp(lambda) * lambda^x]___(1) X=0, 1, 2, 3, ... lambda = not zero real positive.
In order to simulate the r.v. Let be a random number u. As long as the C(x)  Cumulative Distribution Function  right bounds are not larger than u we continue the comparison procedure: The X=x is got when we find Sum [P(x)]>u. Note that a recursive algorithm allows to calculate the probability of no matter x: P(x+1)= P(x) * lambda/(x+1), P(x=0) = exp(lambda)
For example u= 0.9920 and lambda=1 the cumulative distribution C(x) is
____C(0)= 0.3679 = P(0) = exp(1) ____C(1)= 0.7358 ____C(2)= 0.9197 ____C(3)= 0.9810_____0.9920 ____C(4)= 0.9963 . . . . . . . And we get x=3.
This method is both rigorous and general: it works for any discrete Distribution to which one can obtain the Cumulative Distribution inverse, x= f(CDF) = f(RND). If the r.v. X is continuous, given RND, to try, step h, successively, x= x0 + j*h (x0 negative say 10000 , h=1), just till CDF(x1) > RND, to go 2 steps behind, CDF(x´= x12*h), put h1=h/10 and repeat the procedure till CDF (x2) > RND, x3=x2  2*h1, and so on till CDF(x) = RND with very good approximation, for example hn = .000001.
Example, Phi the cumulative normal, 0< p<1 , B, C, known,
CDF = p* Phi(x/B) + (1p) * Phi(x/C)
Luis A. Afonso



