Compute the “ellipsoid hull” or “spanning ellipsoid”, i.e. the ellipsoid of minimal volume (‘area’ in 2D) such that all given points lie just inside or on the boundary of the ellipsoid.
ellipsoidhull(x, tol=0.01, maxit=5000, ret.wt = FALSE, ret.sqdist = FALSE, ret.pr = FALSE) ## S3 method for class 'ellipsoid': print((x, digits = max(1, getOption("digits") - 2), ...))
- the n p-dimensional points asnumeric n x p matrix.
- convergence tolerance for Titterington's algorithm. Setting this to much smaller values may drastically increase the number of iterations needed, and you may want to increas
- integer giving the maximal number of iteration steps for the algorithm.
- ret.wt, ret.sqdist, ret.pr
- logicals indicating if additional information should be returned,
ret.wtspecifying the weights,
ret.sqdistthe squared distances and
ret.prthe final probabilities in the algorithms.
- the usual arguments to
The “spanning ellipsoid” algorithm is said to stem from Titterington(1976), in Pison et al(1999) who use it for
The problem can be seen as a special case of the “Min.Vol.” ellipsoid of which a more more flexible and general implementation is
cov.mve in the
an object of class
"ellipsoid", basically a
list with several components, comprising at least
- p x p covariance matrix description the ellipsoid.
- p-dimensional location of the ellipsoid center.
- average squared radius. Further, d2 = t^2, where t is “the value of a t-statistic on the ellipse boundary” (from
ellipsein the ellipse package), and hence, more usefully,
d2 = qchisq(alpha, df = p), where
alphais the confidence level for p-variate normally distributed data with location and covariance
covto lie inside the ellipsoid.
- the vector of weights iff
- the vector of squared distances iff
- the vector of algorithm probabilities iff
- number of iterations used.
- tol, maxit
- just the input argument, see above.
- the achieved tolerance which is the maximal squared radius minus p.
- error code as from the algorithm;
- logical indicating if the converged. This is defined as
it < maxit && ierr == 0.
Pison, G., Struyf, A. and Rousseeuw, P.J. (1999) Displaying a Clustering with CLUSPLOT, Computational Statistics and Data Analysis, 30, 381--392.
A version of this is available as technical report from http://www.agoras.ua.ac.be/abstract/Disclu99.htm
D.M. Titterington (1976) Algorithms for computing D-optimal design on finite design spaces. In Proc.\ of the 1976 Conf.\ on Information Science and Systems, 213--216; John Hopkins University.
predict.ellipsoid which is also the
predict method for
volume.ellipsoid for an example of ‘manual’
ellipsoid object construction;
ellipse from package ellipse and
ellipsePoints from package sfsmisc.
x <- rnorm(100) xy <- unname(cbind(x, rnorm(100) + 2*x + 10)) exy <- ellipsoidhull(xy) exy # >> calling print.ellipsoid() plot(xy) lines(predict(exy)) points(rbind(exy$loc), col = "red", cex = 3, pch = 13) exy <- ellipsoidhull(xy, tol = 1e-7, ret.wt = TRUE, ret.sq = TRUE) str(exy) # had small `tol', hence many iterations (ii <- which(zapsmall(exy $ wt) > 1e-6)) # only about 4 to 6 points round(exy$wt[ii],3); sum(exy$wt[ii]) # sum to 1
Documentation reproduced from package cluster, version 1.14.4. License: GPL (>= 2)