naginterfaces.library.rand.int_​poisson_​varmean

naginterfaces.library.rand.int_poisson_varmean(vlamda, statecomm)[source]

int_poisson_varmean generates a vector of pseudorandom integers, each from a discrete Poisson distribution with differing parameter.

For full information please refer to the NAG Library document for g05tk

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g05/g05tkf.html

Parameters
vlamdafloat, array-like, shape

The means, , for , of the Poisson distributions.

statecommdict, RNG communication object, modified in place

RNG communication structure.

This argument must have been initialized by a prior call to init_repeat() or init_nonrepeat().

Returns
xint, ndarray, shape

The pseudorandom numbers from the specified Poisson distributions.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, at least one element of is less than zero.

(errno )

On entry, at least one element of is too large.

(errno )

On entry, [‘state’] vector has been corrupted or not initialized.

Notes

int_poisson_varmean generates integers , each from a discrete Poisson distribution with mean , where the probability of is

where

The methods used by this function have low set up times and are designed for efficient use when the value of the parameter changes during the simulation. For large samples from a distribution with fixed using int_poisson() to set up and use a reference vector may be more efficient.

When the product of uniforms method is used, see for example Dagpunar (1988). For larger values of an envelope rejection method is used with a target distribution:

This distribution is generated using a ratio of uniforms method. A similar approach has also been suggested by Ahrens and Dieter (1989). The basic method is combined with quick acceptance and rejection tests given by Maclaren (1990). For values of Stirling’s approximation is used in the computation of the Poisson distribution function, otherwise tables of factorials are used as suggested by Maclaren (1990).

One of the initialization functions init_repeat() (for a repeatable sequence if computed sequentially) or init_nonrepeat() (for a non-repeatable sequence) must be called prior to the first call to int_poisson_varmean.

References

Ahrens, J H and Dieter, U, 1989, A convenient sampling method with bounded computation times for Poisson distributions, Amer. J. Math. Management Sci., 1–13

Dagpunar, J, 1988, Principles of Random Variate Generation, Oxford University Press

Maclaren, N M, 1990, A Poisson random number generator, Personal Communication