Does anyone know how to generate Poisson random variables when the mean is above 745? Using the code below work up to a mean of 745, after that point it just loops infinitely. I think it is related to the machine epsilon of Excel but I don't know of a work around to make it operate above 745.
Public Function pos(Mean)
' Generate and return a random Poisson variable
' with mean Mean
Dim Value As Double
Dim Prod As Double
Value = Exp(-Mean)
Prod = 1
Do Until (Prod < Value)
pos = pos + 1
Prod = Prod * Rnd()
Loop
pos = pos - 1
End Function
---------- Post added at 02:13 PM ---------- Previous post was at 11:10 AM ----------
I'm still struggling with this...
Bookmarks