runif_ellipsoid {thames} | R Documentation |
Uniform sampling on/in ellipsoid
Description
Uniform sampling on an ellipsoid or in an ellipsoid. The sampling in an ellipsoid is available in arbitrary dimension. The sampling on an ellipsoid is available only in dimension 2 or 3. This code is borrowed directly from the uniformly package (https://CRAN.R-project.org/package=uniformly)
Usage
runif_on_ellipse(n, A, r)
runif_on_ellipsoid(n, A, r)
runif_in_ellipsoid(n, A, r)
Arguments
n |
number of simulations |
A |
symmetric positive-definite matrix defining the ellipsoid (see
Details), of size 2 for |
r |
"radius" (see Details) |
Details
The ellipsoid is the set of vectors x
satisfying
t(x) %*% A %*% x == r^2
. For example, for an axis-aligned
ellipse with horizontal radius a
and vertical radius b
, take
A=1/diag(c(a^2,b^2))
and r=1
.
Value
The simulations in a matrix with n
rows.