g05tk generates a vector of pseudorandom integers, each from a discrete Poisson distribution with differing parameter.
Syntax
C# |
---|
public static void g05tk( int m, double[] vlamda, G05..::..G05State g05state, int[] x, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g05tk ( _ m As Integer, _ vlamda As Double(), _ g05state As G05..::..G05State, _ x As Integer(), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g05tk( int m, array<double>^ vlamda, G05..::..G05State^ g05state, array<int>^ x, [OutAttribute] int% ifail ) |
F# |
---|
static member g05tk : m : int * vlamda : float[] * g05state : G05..::..G05State * x : int[] * ifail : int byref -> unit |
Parameters
- m
- Type: System..::..Int32On entry: , the number of Poisson distributions for which pseudorandom variates are required.Constraint: .
- vlamda
- Type: array<System..::..Double>[]()[][]An array of size [m]On entry: the means, , for , of the Poisson distributions.Constraint: , for .
- g05state
- Type: NagLibrary..::..G05..::..G05StateAn Object of type G05.G05State.
- x
- Type: array<System..::..Int32>[]()[][]An array of size [m]On exit: the pseudorandom numbers from the specified Poisson distributions.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
g05tk generates integers , each from a discrete Poisson distribution with mean , where the probability of is
where
The methods used by this method 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 g05tj 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 methods (G05KFF not in this release) (for a repeatable sequence if computed sequentially) or (G05KGF not in this release) (for a non-repeatable sequence) must be called prior to the first call to g05tk.
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
Error Indicators and Warnings
Errors or warnings detected by the method:
- On entry, .
- On entry, for at least one value of .On entry, for at least one value of .
On entry, state vector was not initialized or has been corrupted.
Accuracy
Not applicable.
Parallelism and Performance
None.
Further Comments
None.