[R] volume of ellipsoid

Yuanzhi Li Yuanzhi.Li at USherbrooke.ca
Wed Nov 13 23:31:06 CET 2013


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



More information about the R-help mailing list