View source: R/ellipsoidhull.R
predict.ellipsoid | R Documentation |
Compute points on the ellipsoid boundary, mostly for drawing.
predict.ellipsoid(object, n.out=201, ...)
## S3 method for class 'ellipsoid'
predict(object, n.out=201, ...)
ellipsoidPoints(A, d2, loc, n.half = 201)
object |
an object of class |
n.out, n.half |
half the number of points to create. |
A, d2, loc |
arguments of the auxilary |
... |
passed to and from methods. |
Note ellipsoidPoints
is the workhorse function of
predict.ellipsoid
a standalone function and method for
ellipsoid
objects, see ellipsoidhull
.
The class of object
is not checked; it must solely have valid
components loc
(length p
), the p \times p
matrix cov
(corresponding to A
) and d2
for the
center, the shape (“covariance”) matrix and the squared average
radius (or distance) or qchisq(*, p)
quantile.
Unfortunately, this is only implemented for p = 2
, currently;
contributions for p \ge 3
are very welcome.
a numeric matrix of dimension 2*n.out
times p
.
ellipsoidhull
, volume.ellipsoid
.
## see also example(ellipsoidhull)
## Robust vs. L.S. covariance matrix
set.seed(143)
x <- rt(200, df=3)
y <- 3*x + rt(200, df=2)
plot(x,y, main="non-normal data (N=200)")
mtext("with classical and robust cov.matrix ellipsoids")
X <- cbind(x,y)
C.ls <- cov(X) ; m.ls <- colMeans(X)
d2.99 <- qchisq(0.99, df = 2)
lines(ellipsoidPoints(C.ls, d2.99, loc=m.ls), col="green")
if(require(MASS)) {
Cxy <- cov.rob(cbind(x,y))
lines(ellipsoidPoints(Cxy$cov, d2 = d2.99, loc=Cxy$center), col="red")
}# MASS
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.