> From: Brian Schott <[EMAIL PROTECTED]>
> 
>     The poisson distribution is almost identical to the
> normal distribution when its parameter is 15 or larger, so
> you may want to use the normal distribution. More
> specifically, according to George Fishman, as the mean,
> lambda, increases the distribution of
> (X-lambda)/sqrt(lambda) converges to the standard normal
> distribution (ie mean 0, std dev 1); if Y is from standard
> normal then
> 
> X=max(0,integer [lambda+Y*sqrt(lambda)+0.5])
> 
>     A key feature would be to generate the poisson
> cumulative probabilities only one time as you did in your
> revised approach, whether you use the Poisson or the normal
> approximation. If the mean of the Poisson does not vary,
> then why not generate all 1 000 000 at once?
> 
>     It seems to me that you could generate 1000000
> Poisson and uniform variates all at one time (in an array of
> shape 500 2000?) and then focus on keeping track of the
> (ending) inventory level (i) in your main process using J's
> strength of array processing. This is the challenging part,
> imo, especially avoiding the for. for iteration.

   dstat poissonrand 100 10000
sample size:    10000
minimum:           64
maximum:          141
median:           100
mean:         100.006
std devn:     10.0345
skewness:     0.12287
kurtosis:     3.03206
   dstat <.100+10*normalrand 10000
sample size:      10000
minimum:             61
maximum:            137
median:              99
mean:           99.3547
std devn:       10.0235
skewness:     0.0298283
kurtosis:        3.0363

   plot (i.~ #/. ]) /:~ poissonrand 100  10000
   plot (i.~ #/. ]) /:~ <.100+10*normalrand 10000
   
   3 ts '$<.100+10*normalrand 10000'
0.00326381 1.31347e6
   3 ts '$poissonrand 100 10000'
0.513158 690880


      
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to