halton: Halton sequence

View source: R/RcppExports.R

haltonR Documentation

Halton sequence

Description

Calculate the elements of the Halton sequence and of some other pseudo-random sequences.

Usage

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 than 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 a standard uniform random variable will be added to each element of the sequence, and the difference between this sum and its 'floor' will be returned as a new element of the sequence.

type

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

scrambler

string representing a scrambling method for the Halton sequence. Possible options are "NO" (default), "root" and "negroot", which are described in S. Kolenikov (2012).

is_validation

logical value indicating whether input arguments should be validated. Set it to FALSE to get a 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 than 100000 elements.

Details

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

Value

The function returns a matrix whose i-th column is a sequence with the base base[i] and the elements with indexes from start to start + n.

References

J. Halton (1964) <doi:10.2307/2347972>

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

Examples

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

mnorm documentation built on April 14, 2026, 5:07 p.m.

Related to halton in mnorm...