Calculate elements of the Halton sequence and of some other pseudo-random sequences.
halton(
n = 1L,
base = as.integer(c(2)),
start = 1L,
random = "NO",
type = "halton",
scrambler = "NO",
is_validation = TRUE,
n_cores = 1L
)
The function returns a matrix which i
-th column
is a sequence with base base[i]
and elements with indexes
from start
to start + n
.
positive integer representing the number of sequence elements.
vector of positive integers greater then one representing the bases for each of the sequences.
non-negative integer representing the index of the first element of the sequence to be included in the output sequence.
string representing the method of randomization to be
applied to the sequence. If random = "NO"
(default) then
there is no randomization. If random = "Tuffin"
then standard uniform
random variable will be added to each element of the sequence and
the difference between this sum and it's 'floor' will be returned as
a new element of the sequence.
string representing type of the sequence. Default is "halton" that is Halton sequence. The alternative is "richtmyer" corresponding to Richtmyer sequence.
string representing scrambling method for the
Halton sequence. Possible options are "NO"
(default), "root"
and "negroot"
which described in S. Kolenikov (2012).
logical value indicating whether input
arguments should be validated. Set it to FALSE
to get
performance boost (default value is TRUE
).
positive integer representing the number of CPU cores
used for parallel computing. Currently it is not recommended to set
n_cores > 1
if vectorized arguments include less then 100000 elements.
Function seqPrimes
could be used to
provide the prime numbers for the base
input argument.
J. Halton (1964) <doi:10.2307/2347972>
S. Kolenikov (2012) <doi:10.1177/1536867X1201200103>
halton(n = 100, base = c(2, 3, 5), start = 10)
Run the code above in your browser using DataLab