qrng {qrng} | R Documentation |
Compute Quasi-Random Sequences
Description
Computing Korobov, generalize Halton and Sobol' quasi-random sequences.
Usage
korobov(n, d = 1, generator, randomize = c("none", "shift"))
ghalton(n, d = 1, method = c("generalized", "halton"))
sobol (n, d = 1, randomize = c("none", "digital.shift", "Owen", "Faure.Tezuka",
"Owen.Faure.Tezuka"), seed, skip = 0, ...)
Arguments
n |
number |
d |
dimension |
generator |
|
randomize |
|
method |
|
seed |
if provided, an integer used within
|
skip |
number of initial points in the sequence to be skipped
( |
... |
additional arguments passed to |
Details
For sobol()
examples see demo(sobol_examples)
.
Note that these procedures call fast C code. The following restrictions apply:
- korobov()
n
,d
must be\le 2^{31}-1
.- ghalton()
n
must be\le 2^{32}-1
andd
must be\le 360
.- sobol()
if
randomize = "none"
orrandomize = "digital.shift"
,n
must be\le 2^{31}-1
andd
must be\le 16510
.
The choice of parameters for korobov()
is crucial for the quality of
this quasi-random sequence (only basic sanity checks are
conducted). For more details, see l'Ecuyer and Lemieux (2000).
The generalized Halton sequence uses the scrambling factors of Faure and Lemieux (2009).
Value
korobov()
and ghalton()
return an
(n,d)
-matrix
; for d=1
an n
-vector
is returned.
Author(s)
Marius Hofert and Christiane Lemieux
References
Faure, H., Lemieux, C. (2009). Generalized Halton Sequences in 2008: A Comparative Study. ACM-TOMACS 19(4), Article 15.
l'Ecuyer, P., Lemieux, C. (2000). Variance Reduction via Lattice Rules. Stochastic Models and Simulation, 1214–1235.
Lemieux, C., Cieslak, M., Luttmer, K. (2004). RandQMC User's guide. See https://www.math.uwaterloo.ca/~clemieux/randqmc/guide.pdf
Examples
n <- 1021 # prime
d <- 4 # dimension
## Korobov's sequence
generator <- 76 # see l'Ecuyer and Lemieux
u <- korobov(n, d = d, generator = generator)
pairs(u, gap = 0, pch = ".", labels = as.expression(
sapply(1:d, function(j) bquote(italic(u[.(j)])))))
## Randomized Korobov's sequence
set.seed(271)
u <- korobov(n, d = d, generator = generator, randomize = "shift")
pairs(u, gap = 0, pch = ".", labels = as.expression(
sapply(1:d, function(j) bquote(italic(u[.(j)])))))
## Generalized Halton sequence (randomized by definition)
set.seed(271)
u <- ghalton(n, d)
pairs(u, gap = 0, pch = ".", labels = as.expression(
sapply(1:d, function(j) bquote(italic(u[.(j)])))))
## For sobol() examples, see demo(sobol_examples)