Calculates a qmesh3d
object representing a 3D ellipsoid
with given center
and shape
matrix. The function allows for
degenerate ellipsoids where the shape
matrix has rank < 3 and plots
as an ellipse or a line.
ellipsoid(center, shape, radius = 1, segments = 60, warn.rank = FALSE)
A qmesh3d object
A vector of length 3 giving the center of the 3D ellipsoid, typically the mean vector of a data matrix.
A 3 x 3 matrix giving the shape of the 3D ellipsoid, typical a covariance matrix of a data matrix.
radius of the ellipsoid, with default radius=1
, giving
a standard ellipsoid. For a multivariate sample with dfe
degrees of
freedom associated with shape
, an ellipsoid of level
coverage
can be calculated using radius=sqrt(3 * qf(level, 3, dfe))
.
number of line segments to use in each direction in the wire-frame representation of the ellipsoid
warn if the shape
matrix is of rank < 3?
Michael Friendly and John Fox, extending Duncan Murdoch
The ellipsoid is calculated by transforming a unit sphere by the Cholesky
square root of the shape
matrix, and translating to the
center
.
The ellipsoid can be plotted with plot3d