|
NAG[g05mec] NAG[nag_rngs_compd_poisson] - Generates a vector of random integers from a Poisson distribution with varying mean, seeds and generator number passed explicitly
|
|
Calling Sequence
g05mec(vlamda, x, igen, iseed, 'm'=m, 'fail'=fail)
nag_rngs_compd_poisson(. . .)
Parameters
|
vlamda - Vector(1..m, datatype=float[8]);
|
|
|
On entry: the means, , for , of the Poisson distributions.
|
|
|
x - Vector(1..m, datatype=integer[kernelopts('wordsize')/8]);
|
|
|
On exit: the pseudo-random numbers from the specified Poisson distributions.
|
|
|
iseed - Vector(1.., datatype=integer[kernelopts('wordsize')/8]);
|
|
|
On entry: contains values which define the current state of the selected generator.
|
|
On exit: contains updated values defining the new state of the selected generator.
|
|
|
'm'=m - integer; (optional)
|
|
|
On entry: , the number of Poisson distributions for which pseudo-random variates are required.
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_rngs_compd_poisson (g05mec) generates a vector of pseudo-random integers, each from a discrete Poisson distribution with differing argument .
|
|
Description
|
|
nag_rngs_compd_poisson (g05mec) 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 argument changes during the simulation. For large samples from a distribution with fixed using g05mkc (nag_rngs_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 g05kbc (nag_rngs_init_repeatable) (for a repeatable sequence if computed sequentially) or g05kcc (nag_rngs_init_nonrepeatable) (for a non-repeatable sequence) must be called prior to the first call to nag_rngs_compd_poisson (g05mec).
|
|
Error Indicators and Warnings
|
|
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_INT"
On entry, . Constraint: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_REAL_ARRAY_ELEM_CONS"
On entry, for at least one value of .
On entry, at least one element of .
|
|
|
Examples
|
|
>
|
m := 5:
igen := 1:
vlamda := Vector([0.5, 5, 10, 500, 1000], datatype=float[8]):
x := Vector(5, datatype=integer[kernelopts('wordsize')/8]):
iseed := Vector([1762543, 9324783, 423442, 742355], datatype=integer[kernelopts('wordsize')/8]):
NAG:-g05mec(vlamda, x, igen, iseed, 'm' = m):
|
|
|
See Also
|
|
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
g05 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|