Use Covariance Matrix to Convert Ellipsoid to Sphere?

135 Views Asked by At

If I have an unbiased ellipsoid with a known covariance, is there a way I can use that covariance matrix to transform all known points on the given ellipsoid to trace a sphere instead?

1

There are 1 best solutions below

0
On

To obtain a sphere you want all of the eigenvalues to be made equal. Left-multiply your datapoints (vectors) by $PDP^{-1}$, where $P$ is a matrix whose columns are the eigenvectors of your covariance matrix $\Sigma$, and $D$ is a diagonal matrix whose $k$th diagonal entry is equal to the required rescaling factor for the eigenvalue associated with $k$th column of $P$. That is:

$$\vec{v}_\text{new} = PDP^{-1}\vec{v}$$

and $$ D = k\Lambda^{-1}$$ $k$ is your desired universal eigenvalue and $\Lambda$ is the diagonal eigenvalue matrix associated with $P$.


Equation of canonical $n$-dimensional hyperellipsoid:

$$\sum \frac{x_i^2}{\alpha_i^2}=1$$

Volume of $n$-dimensional hyperellipsoid:

$$V=\frac{\pi^{\frac{n}{2}}}{\Gamma\left(\frac{n}{2}+1\right)}\prod_j\alpha_j$$

For a uniform distribution over the hyperellipsoid, the marginal distribution over R.V. $X_i$:

$$\begin{align}f_{X_i}(x_i) &= \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}\cdots\int_{-\infty}^{\infty} f(x_1,x_2,\cdots,x_n)dx_1dx_2\cdots dx_{i-1} dx_{i+1} \cdots dx_n\\ &= \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}\cdots\int_{-\infty}^{\infty} \frac{\Gamma\left(\frac{n}{2}+1\right)}{\pi^{\frac{n}{2}}\prod_j\alpha_j }dx_1dx_2\cdots dx_{i-1} dx_{i+1} \cdots dx_n\\ &=\frac{\Gamma\left(\frac{n}{2}+1\right)}{\pi^{\frac{n}{2}}\prod_j\alpha_j }\frac{(\alpha_i^2-x_i^2)^{\frac{n-1}{2}}\pi^{\frac{n-1}{2}}}{\Gamma\left(\frac{n-1}{2}+1\right)\alpha_i^{n-1}}\prod_{j\neq i}\alpha_j,\text{ ($(n-1)$-dimensional hyperellipsoid volume at $x_i$)}\\ &= \frac{(\alpha_i^2-x_i^2)^{\frac{n-1}{2}}\Gamma\left(\frac{n}{2}+1\right)}{\pi^{\frac{1}{2}}\alpha_i^{n}\Gamma\left(\frac{n+1}{2}\right)} \end{align}$$

Variance of the marginal distribution over $X_i$:

$$\begin{align} \int_{-\alpha_i}^{\alpha_i} \frac{\Gamma\left(\frac{n}{2}+1\right)}{\pi^{\frac{1}{2}}\alpha_i^{n}\Gamma\left(\frac{n+1}{2}\right)} x_i^2(\alpha_i^2-x_i^2)^{\frac{n-1}{2}} dx_i &= \frac{\Gamma\left(\frac{n}{2}+1\right)}{\pi^{\frac{1}{2}}\alpha_i^{n}\Gamma\left(\frac{n+1}{2}\right)} \frac{\pi^{\frac{1}{2}} {\alpha_i}^{n + 2} \Gamma\left(\frac{n+1}{2}\right)}{2 \Gamma\left(\frac{n}{2} + 2\right)}\\ &=\frac{\Gamma\left(\frac{n}{2}+1\right){\alpha_i}^{ 2}}{2 \Gamma\left(\frac{n}{2} + 2\right)} \\ &= \frac{2{\alpha_i}^{ 2}}{2 (n+2)}\\ &= \frac{\alpha_i^2}{n+2} \end{align}\\ $$

Therefore the $i$th semiaxis has length:

$$\alpha_i=\sigma_i\sqrt{n+2}$$

where $\sigma_i$ is the standard deviation in the $i$th (orthogonal) direction.

So by multiplying the square root of the $i$th eigenvalue of the $n\times n$ covariance matrix by $\sqrt{n+2}$ you get an approximation of the $i$th semi-axis length.