rsphere: Generation of Deviates Uniformly Located on a Spherical...

Description Usage Arguments Details Value References See Also Examples

View source: R/random.R

Description

Random vector generation uniformly on the sphere.

Usage

1
rsphere(n = 1, p = 2)

Arguments

n

the number of samples requested

p

dimension of the unitary sphere

Details

The function rsphere is an interface to C routines, which make calls to subroutines from BLAS.

Value

If n = 1 a p-dimensional vector, otherwise a matrix of n rows of random vectors.

References

Devroye, L. (1986). Non-Uniform Random Variate Generation. Springer-Verlag, New York.

See Also

runif

Examples

1
2
3
4
5
6
7
8
# generate the sample
z <- rsphere(n = 200)

# scatterplot of a random sample of 200 points uniformly distributed
# on the unit circle
par(pty = "s")
plot(z, xlab = "x", ylab = "y")
title("200 points on the circle", font.main = 1)

heavy documentation built on Oct. 30, 2019, 9:48 a.m.

Related to rsphere in heavy...