nag_quasi_rand_lognormal (g05ykc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_quasi_rand_lognormal (g05ykc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_quasi_rand_lognormal (g05ykc) generates a quasi-random sequence from a log-normal distribution. It must be preceded by a call to one of the initialization functions nag_quasi_init (g05ylc) or nag_quasi_init_scrambled (g05ync).

2  Specification

#include <nag.h>
#include <nagg05.h>
void  nag_quasi_rand_lognormal (Nag_OrderType order, const double xmean[], const double std[], Integer n, double quas[], Integer pdquas, Integer iref[], NagError *fail)

3  Description

nag_quasi_rand_lognormal (g05ykc) generates a quasi-random sequence from a log-normal distribution by first generating a uniform quasi-random sequence which is then transformed into a log-normal sequence using the exponential of the inverse of the Normal CDF. The type of uniform sequence used depends on the initialization function called and can include the low-discrepancy sequences proposed by Sobol, Faure or Niederreiter. If the initialization function nag_quasi_init_scrambled (g05ync) was used then the underlying uniform sequence is first scrambled prior to being transformed (see Section 3 in nag_quasi_init_scrambled (g05ync) for details).

4  References

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

5  Arguments

Note: the following variables are used in the parameter descriptions:
1:     orderNag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     xmean[idim]const doubleInput
On entry: specifies, for each dimension, the mean of the underlying Normal distribution.
Constraint: xmean[i-1]-lognag_real_safe_small_number-10.0×std[i-1], for i=1,2,,idim.
3:     std[idim]const doubleInput
On entry: specifies, for each dimension, the standard deviation of the underlying Normal distribution.
Constraint: std[i-1]0.0, for i=1,2,,idim.
4:     nIntegerInput
On entry: the number of quasi-random numbers required.
Constraint: n0 and n+previous number of generated values231-1.
5:     quas[dim]doubleOutput
Note: the dimension, dim, of the array quas must be at least
  • max1,pdquas×idim when order=Nag_ColMajor;
  • max1,n×pdquas when order=Nag_RowMajor.
Where QUASi,j appears in this document, it refers to the array element
  • quas[j-1×pdquas+i-1] when order=Nag_ColMajor;
  • quas[i-1×pdquas+j-1] when order=Nag_RowMajor.
On exit: QUASi,j holds the ith value for the jth dimension.
6:     pdquasIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array quas.
Constraints:
  • if order=Nag_ColMajor, pdquasn;
  • if order=Nag_RowMajor, pdquasidim.
7:     iref[liref]IntegerCommunication Array
On entry: contains information on the current state of the sequence.
On exit: contains updated information on the state of the sequence.
8:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INITIALIZATION
On entry, iref has either not been initialized or has been corrupted.
NE_INT
On entry, n=value.
Constraint: n0.
NE_INT_2
On entry, pdquas=value and idim=value.
Constraint: pdquasidim.
On entry, pdquas=value and n=value.
Constraint: pdquasn.
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 contact NAG for assistance.
NE_REAL_ARRAY
On entry, at least one element of xmean is too large, xmean[value]=value.
Constraint: xmean[i]value.
On entry, std[value]=value.
Constraint: std[i]0.
NE_TOO_MANY_CALLS
There have been too many calls to the generator.

7  Accuracy

Not applicable.

8  Further Comments

None.

9  Example

This example calls nag_quasi_init (g05ylc) to initialize the generator and then nag_quasi_rand_lognormal (g05ykc) to produce a sequence of five four-dimensional quasi-random numbers variates.

9.1  Program Text

Program Text (g05ykce.c)

9.2  Program Data

None.

9.3  Program Results

Program Results (g05ykce.r)


nag_quasi_rand_lognormal (g05ykc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012