quasiRNG: Toolbox for quasi random number generation

randsobolfortranR Documentation

Toolbox for quasi random number generation

Description

the Sobol sequence.

Usage

sobol.fortran(n, dim = 1, init = TRUE, scrambling = 0, seed = NULL, normal = FALSE,
                   mixed = FALSE, method = "Fortran", mexp = 19937, start = 1,
                   maxit = 10)

Arguments

n

number of observations. If length(n) > 1, the length is taken to be the required number.

dim

dimension of observations default 1.

init

a logical, if TRUE the sequence is initialized and restarts to the start value, otherwise not. By default TRUE.

normal

a logical if normal deviates are needed, default FALSE.

scrambling

an integer value, if 1, 2 or 3 the sequence is scrambled otherwise not. If scrambling=1, Owen type type of scrambling is applied, if scrambling=2, Faure-Tezuka type of scrambling, is applied, and if scrambling=3, both Owen+Faure-Tezuka type of scrambling is applied. By default 0.

seed

an integer value, the random seed for initialization of the scrambling process (only for sobol with scrambling>0). If NULL, set to 4711.

mixed

a logical to combine the QMC algorithm with the SFMT algorithm, default FALSE.

method

a character string either "Fortran".

mexp

an integer for the Mersenne exponent of SFMT algorithm, only used when mixed=TRUE.

start

an integer to initiliaze the sequence, default to 1, only used when init=TRUE.

maxit

a positive integer used to control inner loops both for generating randomized seed and for controlling outputs (when needed).

Details

The currently available generator are given below. Whatever the sequence, when normal=TRUE, outputs are transformed with the quantile of the standard normal distribution qnorm. If init=TRUE, the default, unscrambled and unmixed-SFMT quasi-random sequences start from start. If start != 0 and normal=FALSE, we suggest to use 0 as recommended by Owen (2020). One must handle the starting value (0) correctly if a quantile function of a not-lower-bounded distribution is used.

(scrambled) Sobol sequences

Computes uniform Sobol low discrepancy numbers. The sequence starts from k=1 when initialized with init = TRUE (default). When scrambling > 0, a scrambling is performed or when mixed = TRUE, a randomized seed is performed. If some number of Sobol sequences are generated outside [0,1) with scrambling, the seed is randomized until we obtain all numbers in [0,1). One version of Sobol sequences is available the current version in Fortran (method = "Fortran") since method = "C" is under development.

See the pdf vignette for details.

Value

sobol.fortran generates random variables in [0,1). It returns a nxdim matrix, when dim>1 otherwise a vector of length n.

Author(s)

Christophe Dutang and Diethelm Wuertz

References

Bratley P., Fox B.L. (1988), Algorithm 659: Implementing Sobol's Quasirandom Sequence Generator, ACM Transactions on Mathematical Software 14, 88–100.

Joe S., Kuo F.Y. (1998), Remark on Algorithm 659: Implementing Sobol's Quaisrandom Seqence Generator.

Owen A.B. (2020), On dropping the first Sobol' point, https://arxiv.org/abs/2008.08051.

Examples



# (3) Sobol sequences
#

# uniform variate
sobol.fortran(n = 10, dim = 5, scrambling = 3)



randsobolfortran documentation built on Sept. 9, 2022, 3:07 p.m.