|
NAG[g05lqc] NAG[nag_rngs_exp_mix] - Generates a vector of random numbers from an exponential mixture distribution, seeds and generator number passed explicitly
|
|
Calling Sequence
g05lqc(a, wgt, n, x, igen, iseed, 'nmix'=nmix, 'fail'=fail)
nag_rngs_exp_mix(. . .)
Parameters
|
a - Vector(1..nmix, datatype=float[8]);
|
|
|
Constraint: , for . .
|
|
|
wgt - Vector(1..nmix, datatype=float[8]);
|
|
|
;
|
|
, for .
|
|
|
n - integer;
|
|
|
On entry: , the number of pseudo-random numbers to be generated.
|
|
Constraint: . .
|
|
|
x - Vector(1..dim, datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array x must be at least .
|
|
On exit: the pseudo-random numbers from the specified exponential mix 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.
|
|
|
'nmix'=nmix - integer; (optional)
|
|
|
On entry: , the number of exponential distributions in the mix.
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_rngs_exp_mix (g05lqc) generates a vector of pseudo-random numbers from an exponential mix distribution composed of exponential distributions each having a mean and weight .
|
|
Description
|
|
The distribution has PDF (probability density function)
where and , .
nag_rngs_exp_mix (g05lqc) returns the values by selecting, with probability , random variates from an exponential distribution with argument .
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_exp_mix (g05lqc).
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_INT"
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_REAL"
On entry, sum of weights wgt is not equal to 1.0: sum .
"NE_REAL_ARRAY_ELEM_CONS"
On entry, : , .
On entry, : , .
|
|
|
Examples
|
|
>
|
nmix := 3:
n := 5:
igen := 1:
a := Vector([1, 5, 2], datatype=float[8]):
wgt := Vector([0.5, 0.3, 0.2], datatype=float[8]):
x := Vector(5, datatype=float[8]):
iseed := Vector([1762543, 9324783, 42344, 742355], datatype=integer[kernelopts('wordsize')/8]):
NAG:-g05lqc(a, wgt, n, x, igen, iseed, 'nmix' = nmix):
|
|
|