Effective rank of a covariance matrix (source code)

= Effective rank of a covariance matrix
{title2=$r(\Sigma)=\operatorname{tr}(\Sigma)/\lVert\Sigma\rVert_{\mathrm{op}}$}

= Covariance effective rank
{synonym}

For a nonzero <positive semidefinite> <covariance matrix> $\Sigma$, its <covariance effective rank> is
$$
r(\Sigma)=\frac{\operatorname{tr}(\Sigma)}{\|\Sigma\|_{\mathrm{op}}}=\frac{\sum_j\lambda_j}{\lambda_{\max}},
$$
where the <operator norm> is induced by <Euclidean norm> and the $\lambda_j$ are the nonnegative <eigenvalues>. Each nonzero <eigenvalue> contributes at most one to this ratio, so
$$
1\leq r(\Sigma)\leq\operatorname{rank}(\Sigma)\leq p.
$$
A scalar multiple of $I_p$ has <covariance effective rank> $p$, while a <matrix> $\lambda uu^T$ with $\lambda>0$ and a <unit vector> $u$ has <covariance effective rank> one. For $\Sigma=\operatorname{diag}(100,1,1)$, the ratio is $102/100=1.02$, although the ordinary <matrix rank> is three.

Thus the quantity measures total <variance> relative to the largest directional <variance>, rather than merely counting nonzero directions. Multiplying $\Sigma$ by a positive scalar leaves the ratio unchanged. Its role in the <Gaussian sample-covariance operator-norm bound> makes it a useful measure of the dimension that matters for <covariance> estimation. The zero <matrix> requires a separate convention because the displayed ratio is $0/0$.