0
$\begingroup$

I've been reading this code and I found that the number of non-zero eigenvalues of the estimated covariance is equal to $x_i^T \Sigma^{-1} x_i$. I want to know how to arrive at this result.

Some background:

  • $x_i$ is a real column vector with dimension $d$ (one sample)
  • $X = [x_1, x_2, ..., x_n]$ with shape $d$x$n$ (all the samples)

I want to prove that:
$$\sum_{i=0}^{i=n} x_i^T \Sigma^{-1} x_i = n.len(s)$$ being $len(s)$ the number of non-zero singular values* of $\Sigma$, that is defined as
$$\Sigma = \frac{1}{n} \sum_{j=1}^{j=n} x_j x_j^T$$

If necessary, mean can be considered $0$

*Not necessarily mathematical $0$, this can also mean "not too small values" .
Actually non-zero is "non-negligible" depending on a threshold defined as the largest singular value times the square root of the machine epsilon.
In Python: s[0] * np.sqrt(np.finfo(np.float).eps) being s the singular values in descending order (see the code)

$\endgroup$
  • $\begingroup$ How do you propose to compute $\Sigma^{-1}$ if $\Sigma$ has zero singular values? Otherwise, this is just a trace identity. The answer should always be $n$. $\endgroup$ – Hans Engler Nov 16 '18 at 21:54
  • $\begingroup$ In fact, the question is about the proposal itself. The code I'm looking into, and this other R package, assume the proposition that involves $n. len(s)$. I want to know when it's valid, and what approximations and assumptions are being made. Sorry if it wasn't clear $\endgroup$ – Franco Marchesoni Nov 19 '18 at 21:07
0
$\begingroup$

Assuming that the sample $\{x_i\}$ spans the whole space $\mathbb{R}^d$, the value is always $nd$. Here is the proof:

Using your notation for $X$, we know $\Sigma = \frac{1}{n} XX^T$ and therefore $\Sigma^{-1} = n \left(XX^T \right)^{-1}$. Then $$ x_i^T \Sigma^{-1} x_i = tr(x_i^T \Sigma^{-1} x_i) = tr(\Sigma^{-1} x_i x_i^T) $$
and therefore $$ \sum_{i = 1}^n x_i^T \Sigma^{-1} x_i = tr(\Sigma^{-1} \sum_{i=1}^n x_i x_i^T) = tr(\Sigma^{-1} (XX^T)) = n tr(I_d) = nd $$ where $I_d$ is the $d$-dim identity matrix.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.