halton: Halton sequence

View source: R/RcppExports.R

haltonR Documentation

Halton sequence

Description

Calculate 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 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.

Details

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

Value

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.

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 Aug. 22, 2023, 9:12 a.m.

Related to halton in mnorm...