# [R] volume of ellipsoid

yuanzhi yuanzhi.li at usherbrooke.ca
Thu Nov 14 15:44:33 CET 2013

```Carl Witthoft wrote
> Well, given that an upvoted question on math.stackexchange got no answers,
> I'd say you're asking a very difficult question.   Perhaps this paper
> http://www.geometrictools.com/Documentation/IntersectionOfEllipsoids.pdf
>
> will be of some help.   It's possible that you could do:
> 1) find the ellipse of intersection of the two ellipsoids
> 2) find some formula for the equivalent of the "spherical cap" volume
> 3) apply that formula to each ellipsoid, using the intersection ellipse as
> the base of the caps.
>
> All this, btw, is math,  not really related to R or to software
> programming in general.
> yuanzhi wrote
>> Hi, everyone!
>>
>> I have a matrix X(n*p) which is n samples from a p-dimensional normal
>> distribution. Now I want to make the ellipsoid containing (1-α)% of
>> the probability in the distribution based on Mahalanobis distance:
>>
>> μ:(x-μ)'Σ^(-1)(x-μ)≤χ2p(α)
>>
>> where x and Σ is the mean and variance-covariance matrix of X. Are
>> there some functions in R which can plot the ellipsoid and calculate
>> the volume (area for p=2, hypervolume for p>3) of the ellipsoid? I
>> only find the "ellipsoidhull" function in "cluster" package, but it
>> deal with ellipsoid hull containing X, which obvious not the one I want.
>>
>> After that, a more difficult is the following. If we have a series of
>> matrix X1, X2, X3,… Xm which follow different p-dimensional normal
>> distributions. And we make m ellipsoids (E1, E2, … Em) for each matrix
>> like the before. How can we calculate the volume of union of the m
>> ellipsoids? One possible solution for this problem is the
>> inclusion-exclusion principle:
>>
>> V(⋃Ei)(1≤i≤m)=
>> V(Ei)(1≤i≤m)-∑V(Ei⋂Ej)(1≤i<j≤m)+∑V(Ei⋂Ej⋂Ek)(1≤i<j<k≤m)+(-1)^(m-1)V(E1⋂…⋂Em)
>>
>> But the problem is how to calculate the volume of intersection between
>> 2, 3 or more ellipsoids. Are there some functions which can calculate
>> the volume of intersection between two region or functions which
>> directly calculate the volume of a union of two region(the region here
>> is ellipsoid). OR yo you have any good ideas solving this problem in
>> R? Thank you all in advance!
>>
>> Yuanzhi
>>
>> ______________________________________________
>> <email>R-help@

>>  mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

Hi, Carl Witthoft

yes, it looks like a mathematical question. I will try based on your
suggestion to calculate the volume of the intersection. But I still want to
know whether there are some functions in R which can calculate the volume of
an ellipsoid(area for p=2, hypervolume for p>3) containing X, just like the
"convhulln" function in "geometry" package which can calculate the volume of
convex hull containing X.
thanks!

--
View this message in context: http://r.789695.n4.nabble.com/volume-of-ellipsoid-tp4680409p4680446.html
Sent from the R help mailing list archive at Nabble.com.

```