NAG Library Routine Document
G05YJF generates a quasi-random sequence from a Normal (Gaussian) distribution. It must be preceded by a call to one of the initialization routines G05YLF
||N, IREF(), IFAIL
||XMEAN(), STD(), QUAS(N,)
G05YJF generates a quasi-random sequence from a Normal distribution by first generating a uniform quasi-random sequence which is then transformed into a Normal sequence using the inverse of the Normal CDF. The type of uniform sequence used depends on the initialization routine called and can include the low-discrepancy sequences proposed by Sobol, Faure or Niederreiter. If the initialization routine G05YNF
was used then the underlying uniform sequence is first scrambled prior to being transformed (see Section 3
in G05YNF for details).
Bratley P and Fox B L (1988) Algorithm 659: implementing Sobol's quasirandom sequence generator ACM Trans. Math. Software 14(1) 88–100
Fox B L (1986) Algorithm 647: implementation and relative efficiency of quasirandom sequence generators ACM Trans. Math. Software 12(4) 362–376
Wichura (1988) Algorithm AS 241: the percentage points of the Normal distribution Appl. Statist. 37 477–484
the following variables are used in the parameter descriptions:
, the number of dimensions required, see G05YLF or G05YNF;
, the length of IREF as supplied to the initialization routines G05YLF or G05YNF.
- 1: XMEAN() – REAL (KIND=nag_wp) arrayInput
On entry: specifies, for each dimension, the mean of the Normal distribution.
- 2: STD() – REAL (KIND=nag_wp) arrayInput
On entry: specifies, for each dimension, the standard deviation of the Normal distribution.
, for .
- 3: N – INTEGERInput
On entry: the number of quasi-random numbers required.
- 4: QUAS(N,) – REAL (KIND=nag_wp) arrayOutput
: contains the N
quasi-random numbers of dimension idim
- 5: IREF() – INTEGER arrayCommunication Array
On entry: contains information on the current state of the sequence.
On exit: contains updated information on the state of the sequence.
- 6: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
On entry, incorrect initialization has been detected.
A standard deviation is negative.
There have been too many calls to the generator.
This example calls G05YLF
to initialize the generator and then G05YJF to generate a sequence of five four-dimensional variates.
9.1 Program Text
Program Text (g05yjfe.f90)
9.2 Program Data
Program Data (g05yjfe.d)
9.3 Program Results
Program Results (g05yjfe.r)