Compute the Volume (of an Ellipsoid)
volume.ellipsoid.RdCompute the volume of geometric R object.
This is a generic function and has a method for ellipsoid objects
(typically resulting from ellipsoidhull().
Arguments
- object
an R object the volume of which is wanted; for the
ellipsoidmethod, an object of that class (seeellipsoidhullor the example below).- log
logicalindicating if the volume should be returned in log scale. Maybe needed in largish dimensions.- ...
potential further arguments of methods, e.g.
log.
Author
Martin Maechler (2002, extracting from former clusplot code);
Keefe Murphy (2019) provided code for dimensions \(d > 2\).
See also
ellipsoidhull for spanning ellipsoid computation.
Examples
## example(ellipsoidhull) # which defines 'ellipsoid' object <namefoo>
myEl <- structure(list(cov = rbind(c(3,1),1:2), loc = c(0,0), d2 = 10),
class = "ellipsoid")
volume(myEl)# i.e. "area" here (d = 2)
#> [1] 70.24815
myEl # also mentions the "volume"
#> 'ellipsoid' in 2 dimensions:
#> center = ( 0 0 ); squared ave.radius d^2 = 10
#> and shape matrix =
#> [,1] [,2]
#> [1,] 3 1
#> [2,] 1 2
#> hence, area = 70.248
set.seed(1)
d5 <- matrix(rt(500, df=3), 100,5)
e5 <- ellipsoidhull(d5)