Learn R Programming

spatstat (version 1.56-1)

quasirandom: Quasirandom Patterns

Description

Generates quasirandom sequences of numbers and quasirandom spatial patterns of points in any dimension.

Usage

vdCorput(n, base)

Halton(n, bases = c(2, 3), raw = FALSE, simplify = TRUE)

Hammersley(n, bases = 2, raw = FALSE, simplify = TRUE)

Arguments

n

Number of points to generate.

base

A prime number giving the base of the sequence.

bases

Vector of prime numbers giving the bases of the sequences for each coordinate axis.

raw

Logical value indicating whether to return the coordinates as a matrix (raw=TRUE) or as a spatial point pattern (raw=FALSE, the default).

simplify

Argument passed to ppx indicating whether point patterns of dimension 2 or 3 should be returned as objects of class "ppp" or "pp3" respectively (simplify=TRUE, the default) or as objects of class "ppx" (simplify=FALSE).

Value

For vdCorput, a numeric vector.

For Halton and Hammersley, an object of class "ppp", "pp3" or "ppx"; or if raw=TRUE, a numeric matrix.

Details

The function vdCorput generates the quasirandom sequence of Van der Corput (1935) of length n with the given base. These are numbers between 0 and 1 which are in some sense uniformly distributed over the interval.

The function Halton generates the Halton quasirandom sequence of points in d-dimensional space, where d = length(bases). The values of the \(i\)-th coordinate of the points are generated using the van der Corput sequence with base equal to bases[i].

The function Hammersley generates the Hammersley set of points in d+1-dimensional space, where d = length(bases). The first d coordinates of the points are generated using the van der Corput sequence with base equal to bases[i]. The d+1-th coordinate is the sequence 1/n, 2/n, ..., 1.

If raw=FALSE (the default) then the Halton and Hammersley sets are interpreted as spatial point patterns of the appropriate dimension. They are returned as objects of class "ppx" (multidimensional point patterns) unless simplify=TRUE and d=2 or d=3 when they are returned as objects of class "ppp" or "pp3". If raw=TRUE, the coordinates are returned as a matrix with n rows and D columns where D is the spatial dimension.

References

Van der Corput, J. G. (1935) Verteilungsfunktionen. Proc. Ned. Akad. v. Wetensch. 38: 813--821.

Kuipers, L. and Niederreiter, H. (2005) Uniform distribution of sequences, Dover Publications.

See Also

rQuasi

Examples

Run this code
# NOT RUN {
   vdCorput(10, 2)

   plot(Halton(256, c(2,3)))

   plot(Hammersley(256, 3))
# }

Run the code above in your browser using DataLab