Sampling for hyperspheres/hypercubes

Description

Sample uniformly in or on a hyperspheres or hypercubes.

Usage

1
2
3
runif_cube(n, m = 2, max.dist = 1, at = FALSE, nr.dist = 21)

runif_sphere(n, m = 2, max.radius = sqrt(m), at = FALSE, nr.rad = 21)

Arguments

n

number of points to sample

m

number of design factors

max.dist

maximum distance from origin (L-infinity norm/supremum distance) for the hypercuboidal design region (enveloping hypercube)

at

logical indicating whether to sample on concentric hyperspheres/hypercubes or not. With this option n is distributed proportionally across radii / supremum distances so that the density of samples on each concentric hypercube / hypersphere are uniform across the different hyperspheres / hypercubes..

nr.dist

the number of concentric hypercubes to use in case at is TRUE

max.radius

maximum radius of the hyperspherical design region (enveloping hypersphere)

nr.rad

number of concentric hyperspheres to sample on in case of at being TRUE

Author(s)

Pieter C. Schoonees

References

Pieter C. Schoonees, Niel J. le Roux, Roelof L.J. Coetzer (2016). Flexible Graphical Assessment of Experimental Designs in R: The vdg Package. Journal of Statistical Software, 74(3), 1-22. \Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("10.18637/jss.v074.i03")}.

Examples

1
2
3
4
5
6
set.seed(1234)
runif_sphere(n = 10)

set.seed(1234)
samp <- runif_sphere(n = 500, at = TRUE)
plot(samp, asp = 1)