halton function

Halton sequence

Halton sequence

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 )

Arguments

  • n: positive integer representing the number of sequence elements.

  • base: vector of positive integers greater then one representing the bases for each of the sequences.

  • start: non-negative integer representing the index of the first element of the sequence to be included in the output sequence.

  • random: 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.

  • type: string representing type of the sequence. Default is "halton" that is Halton sequence. The alternative is "richtmyer" corresponding to Richtmyer sequence.

  • scrambler: string representing scrambling method for the Halton sequence. Possible options are "NO" (default), "root"

    and "negroot" which described in S. Kolenikov (2012).

  • is_validation: logical value indicating whether input arguments should be validated. Set it to FALSE to get performance boost (default value is TRUE).

  • n_cores: 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.

Returns

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.

Details

Function seqPrimes could be used to provide the prime numbers for the base input argument.

Examples

halton(n = 100, base = c(2, 3, 5), start = 10)

References

J. Halton (1964) doi:10.2307/2347972

S. Kolenikov (2012) doi:10.1177/1536867X1201200103

  • Maintainer: Bogdan Potanin
  • License: GPL (>= 2)
  • Last published: 2023-11-29

Useful links