|
NAG[g05mjc] NAG[nag_rngs_binomial] - Generates a vector of random integers from a binomial distribution, seeds and generator number passed explicitly
|
|
Calling Sequence
g05mjc(mode, m, p, x, igen, iseed, r, 'n'=n, 'fail'=fail)
nag_rngs_binomial(. . .)
Parameters
|
mode - integer;
|
|
|
On entry: a code for selecting the operation to be performed by the function:
|
|
Set up reference vector only.
|
|
Generate variates using reference vector set up in a prior call to nag_rngs_binomial (g05mjc).
|
|
Set up reference vector and generate variates.
|
|
Generate variates without using the reference vector.
|
|
Constraint: . .
|
|
|
m - integer;
|
|
|
On entry: , the number of trials of the distribution.
|
|
Constraint: . .
|
|
|
p - float;
|
|
|
On entry: the probability of success of the binomial distribution.
|
|
Constraint: . .
|
|
|
x - Vector(1..n, datatype=integer[kernelopts('wordsize')/8]);
|
|
|
On exit: the pseudo-random numbers from the specified binomial distribution.
|
|
|
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.
|
|
|
r - Vector(1.. , datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array r must be at least .
|
|
On entry: if mode is set to , the reference vector from the previous call to nag_rngs_binomial (g05mjc).
|
|
On exit: the reference vector.
|
|
|
'n'=n - integer; (optional)
|
|
|
On entry: , the number of pseudo-random numbers to be generated.
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_rngs_binomial (g05mjc) generates a vector of pseudo-random integers from the discrete binomial distribution with arguments and .
|
|
Error Indicators and Warnings
|
|
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_INT"
On entry, . Constraint: .
On entry, . Constraint: .
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_PREV_CALL"
p or m is not the same as when r was set up in a previous call. Previous value of , . Previous value of , .
"NE_REAL"
On entry, or : .
|
|
|
Examples
|
|
>
|
mode := 2:
m := 6000:
p := 0.8:
n := 20:
igen := 1:
x := Vector(20, datatype=integer[kernelopts('wordsize')/8]):
iseed := Vector([1762543, 9324783, 42344, 742355], datatype=integer[kernelopts('wordsize')/8]):
r := Vector(641, datatype=float[8]):
NAG:-g05mjc(mode, m, p, x, igen, iseed, r, 'n' = n):
|
|
|