halton: 'halton' method for class 'npsf'

Description Usage Arguments Value Author(s) See Also Examples

View source: R/halton.R

Description

Provides Halton draws, deviates from a uniform distribution.

Usage

1
2
3
  halton(n = 1, n.bases = 1, bases = NULL, 
                   start = 0, random.primes = FALSE, seed = 7, 
                   scale.coverage = FALSE, shuffle = FALSE)

Arguments

n

number of prime numbers to be returned (the row number in the value).

n.bases

numeric. number of bases used. (the column number in the value).

bases

numeric. Supply specific order numbers for getting primes, see primes. See examples.

start

numeric. from which value in the halton sequence to start. Default is 0, which is actually 0.

random.primes

logical. if TRUE, the n.bases primes are chosen on a random basis from 100008 available prime numbers. See primes.

seed

set seed for replicability. Default is 17345168.

scale.coverage

logical. at larger primes not whole [0,1] interval is covered. if TRUE, rescale is used to fill the coverage.

shuffle

logical. if TRUE, each column in the value is randomly reshuffled (seed is used).

Value

halton returns Halton draws.

Author(s)

Oleg Badunenko <oleg.badunenko@brunel.ac.uk>

See Also

sf and primes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  require( npsf )
  
  # obtain first 10 x 7 matrix with the first 7 primes as bases
  npsf::halton(10, n.bases = 7)
  
  # obtain first 10 x 7 matrix with the randomly chosen 7 primes as bases
  npsf::halton(10, n.bases = 7, random.primes = TRUE, seed = 17345168)
  
  # just one column with desired prime
  npsf::halton(10, bases = 1)
  
  # or 2 columns
  npsf::halton(10, bases = c(1,7))
  
  # if bases are large
  npsf::halton(10, bases = c(1,7)*1000)
  
  # the coverage is not great
  npsf::halton(10, bases = c(1,7)*1000, scale.coverage = TRUE)
  
  # reshuffle them, use seed for replicability
  npsf::halton(10, bases = c(1,7)*1000, scale.coverage = TRUE, shuffle = TRUE, seed = 17345168)
  

npsf documentation built on Nov. 23, 2020, 1:07 a.m.