rball {fastmatrix} | R Documentation |
Generation of deviates uniformly distributed in a unitary ball
Description
Random vector generation uniformly in the unitary ball.
Usage
rball(n = 1, p = 2)
Arguments
n |
the number of samples requested |
p |
dimension of the unitary sphere |
Details
The function rball
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
Hormann, W., Leydold, J., Derflinger, G. (2004). Automatic Nonuniform Random Variate Generation. Springer, New York.
See Also
Examples
# generate the sample
z <- rball(n = 500)
# scatterplot of a random sample of 500 points uniformly distributed
# in the unitary ball
par(pty = "s")
plot(z, xlab = "x", ylab = "y")
title("500 points in the ball", font.main = 1)
[Package fastmatrix version 0.5-772 Index]