In working with a Poisson cumulated distribution function(cdf) I encountered
a difficulty using the above.

This Poisson cdf is a discrete cumulative distribution function. It is then
natural to use I.(or i.) to find a particular position on the curve instead
of a function inverse to generate Poisson distributed random numbers.

limit=: 3 : 0
NB. threshold for mean y
NB. we wish to replace 500 with a function of y to accelerate our Poisson
random number generator
(lm=:+/\(^-y)**/\1,y%}.i.500*y)I.1.0
)

lm tends to rise to 1 gradually but quite rapidly as a function of y.

Let's see:

load 'plot'

plot (;limit"0)i.150

I do not quite understand why this graph is erratic.

If i replace the I. function with i. I will be allowed to limit the
comparison tolerance.

limit1=: 3 : 0
(+/\(^-y)**/\1,y%}.i.500*y)i.!.(2^_35)1.0
)

and the graph looks better:

plot(;limit1"0)i.150

This suggests two conclusions concerning my Poisson random number generator
:

poissonran=: 4 : 0
n=. 50*x
(+/\(^-x)**/\1,x%}.i.>:n)[EMAIL PROTECTED]
)

1. it will be possible to improve on the n=. 50*x line, probably
accelerating the routine a bit.
2. the tail end of the distribution of the random numbers generated may be
inaccurate as when [EMAIL PROTECTED] generates a random number close to 1, the 
position
in the list of cmds may be inaccurate.

In practice this is not a major problem, but a special case may be needed if
we are to avoid problems in this region of the distribution.

I. does not permit a comparison tolerance adjustment, and does not seem to
take into account the general comparison tolerance specified with 9!:19.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to