Convert a normal (gaussian) 2D ellipsoid distribution into 2D circular distribution.

352 Views Asked by At

In my experimental data analysis I have a 2D scatter plot (x,y) which looks ellipsoid (like this). From the underlying physics, I know this distribution should be a circular 2d gaussian (i.e, sigma_x and sigma_y should be the same). But due to experimental detector bias, the measured distribution is ellipsoidal and more to the trouble it is not aligned to X or Y axis (non zero covariance). Now I have to do some correction to this data, to make it circular. One way is to divide the each value (x,y) by corresponding sigmas (xnew = x/sigma_x, ynew = y/sigma_y), but that would have been easier if there was no covariance. So, please help me how to correct this (x,y) distribution so that the corrected distribution becomes circular. How do I calculate the sigma_x,sigma_y, and covariance from the distribution of the x,y points, and then how do I apply the shift for each x,y entry to make a new 2d scatter plot where it becomes circle.

Many thanks,

2

There are 2 best solutions below

1
On

So if $\Sigma$ is your original covariance matrix and it is non-singular then you can decompose it as $$ \Sigma = Q\Lambda Q^{T}, $$ where $\Lambda$ is the diagonal matrix of eigenvalues and $Q$ is the matrix with columns given by the eigenvectors of $\Sigma$, now these eigenvectors are the parallel coordinate vectors you are after so if $y$ is a point in your data set you can carry out the transformation $$ x=\Lambda^{-1/2}Q^Ty, $$ $\Lambda^{-1/2}$ is just the diagonal matrix with entries $1/\sqrt{\lambda_i}$, and it corresponds to your observation about rescaling the axes. So we know that if $Ay$ is a linear transformation of a Gaussian then the new variable is also Gaussian with covariance matrix $A \Sigma A^{T}$, so using that to check the covariance matrix $\Sigma_X$ of our transformed variables we have $$ \begin{align} \Sigma_X&=\left(\Lambda^{-1/2}Q^{T}\right)\Sigma\left(\Lambda^{-1/2}Q^T \right)^T \\ &=\left(\Lambda^{-1/2}Q^{T}\right)Q\Lambda Q^{T} \left(\Lambda^{-1/2}Q^T \right)^T \\ &= I, \end{align} $$ and so we have transformed your initial Gaussian into a circular one.

2
On

The Singular Value Decomposition (SVD) is what you're looking for.

If $A \in \mathbb R^{n \times m}$ is the matrix where each row contains a data vector you can decompose it as $A=USV^*$ where $U \in \mathbb R^{n \times n}, V \in \mathbb R^{m \times m}$ both orthogonal matrices and $S \in \mathbb R^{n \times m}$ is a diagonal matrix. Define $\tilde S$ as another diagonal matrix of the same size as $S$ by replacing the nonzero entries of $S$ by a constant. Then you can get back the transformed data by evaluating $\tilde A = U\tilde SV^*$