Skip to content
nonconvexcard

Covariance Estimation and Sample Complexity

How many samples are needed to estimate a covariance matrix in operator norm, and what the answer says about the curse of dimensionality.

High-Dim StatisticsGraduate⏱ 3 hours9 min readcovariancesample complexityoperator normminimaxshrinkage
4 problems →

The question

Let x1,…,xnx_1,\dots,x_n be i.i.d. mean-zero random vectors in Rp\R^p with covariance Σ\Sigma, and let

Σ^=1n∑i=1nxixi⊤.\hat\Sigma = \frac1n\sum_{i=1}^n x_ix_i^\top .

Σ^\hat\Sigma is unbiased: EΣ^=Σ\E\hat\Sigma = \Sigma. The question is how large ∥Σ^−Σ∥\norm{\hat\Sigma - \Sigma} is, in operator norm, as a function of nn and pp.

Operator norm is the right choice because it is what downstream uses need: it controls the error in every quadratic form v⊤Σ^vv^\top\hat\Sigma v uniformly over vv, hence the error in every projection, every eigenvalue (by Weyl's inequality), and every linear predictor.

TheoremOperator-norm rate for sample covariance estimation

Suppose xix_i are i.i.d., mean zero, with covariance Σ\Sigma, and that ⟨xi,v⟩\ip{x_i}{v} is sub-Gaussian with ∥⟨xi,v⟩∥ψ2≤K∥Σ1/2v∥2\norm{\ip{x_i}{v}}_{\psi_2} \le K\norm{\Sigma^{1/2}v}_2 for all vv (which holds for Gaussian data with KK absolute). Then there is an absolute constant CC such that for every t≥0t\ge0, with probability at least 1−2e−t21 - 2e^{-t^2},

∥Σ^−Σ∥≤CK2∥Σ∥(p+t2n+p+t2n).\norm{\hat\Sigma - \Sigma} \le CK^2\norm{\Sigma}\left(\sqrt{\frac{p + t^2}{n}} + \frac{p+t^2}{n}\right).
CorollarySample complexity of covariance estimation

For ε∈(0,1)\eps \in (0,1), if n≥CK4p/ε2n \ge C K^4 p/\eps^2 then with probability at least 1−2e−p1 - 2e^{-p},

∥Σ^−Σ∥≤ε∥Σ∥,\norm{\hat\Sigma - \Sigma} \le \eps\norm{\Sigma},

i.e. (1−ε)Σ⪯Σ^⪯(1+ε)Σ(1-\eps)\Sigma \preceq \hat\Sigma \preceq (1+\eps)\Sigma when Σ≻0\Sigma \succ 0.

Key idea

n≍p/ε2n \asymp p/\eps^2. The sample complexity of covariance estimation is linear in the dimension, not exponential. This is worth emphasising because "curse of dimensionality" is often used as though every high-dimensional problem were exponentially hard. Estimating p(p+1)/2p(p+1)/2 covariance parameters to fixed relative accuracy in operator norm takes O(p)O(p) samples — each sample carries pp numbers, so this is the information-theoretic minimum up to constants.

HeuristicThe curse of dimensionality, stated as an exponent

Heuristic — a reasoning shortcut that predicts the right answer in the regimes discussed here. It is not a proof and can fail outside them.

The phrase covers at least two different phenomena with very different severity, and keeping them apart resolves most confusion:

  • Parametric estimation in high dimension. Covariance, linear regression, and any model with O(p)O(p) effective parameters need n≍pn \asymp p samples. Linear in pp, and manageable.
  • Nonparametric estimation in high dimension. Estimating an arbitrary Lipschitz function on [0,1]p[0,1]^p to accuracy ε\eps needs n≍ε−pn \asymp \eps^{-p} samples. Exponential in pp, and hopeless beyond small pp.

kk-nearest neighbours, kernel smoothing and histogram methods are in the second class, which is why they degrade so sharply — see the nearest neighbours page.

Shrinkage

The theorem above says Σ^\hat\Sigma is accurate when n≫pn \gg p. When it is not, Σ^\hat\Sigma is poorly conditioned (the Marchenko–Pastur spread) and can be improved by biasing it towards a well-conditioned target.

PropositionLinear shrinkage strictly improves the sample covariance

Consider Σ^α=(1−α)Σ^+α μ^Ip\hat\Sigma_\alpha = (1-\alpha)\hat\Sigma + \alpha\,\hat\mu I_p with μ^=tr⁡(Σ^)/p\hat\mu = \tr(\hat\Sigma)/p and α∈[0,1]\alpha\in[0,1]. If Σ=Ip\Sigma = I_p, then

E∥Σ^α−Σ∥F2=(1−α)2 E∥Σ^−Σ∥F2+α2 p E(μ^−1)2+cross term,\E\norm{\hat\Sigma_\alpha - \Sigma}_F^2 = (1-\alpha)^2\,\E\norm{\hat\Sigma - \Sigma}_F^2 + \alpha^2\,p\,\E(\hat\mu - 1)^2 + \text{cross term},

and there exists α⋆∈(0,1)\alpha^\star \in (0,1) strictly reducing the expected squared Frobenius error whenever E∥Σ^−Σ∥F2>0\E\norm{\hat\Sigma - \Sigma}_F^2 > 0.

Problems

Sample complexity of covariance estimationNumerical · Intermediate · 30 min Optimal linear shrinkageProof · Advanced · 1 hour Weyl's inequality and eigenvalue perturbationProof · Advanced · 30 min Measure the covariance estimation rateCoding · Intermediate · 1 hour

References

  • BookMartin J. Wainwright (2019). High-Dimensional Statistics: A Non-Asymptotic ViewpointChapter 6 gives covariance estimation in the generality used here, with matching lower bounds.
  • PaperRoman Vershynin (2012). How close is the sample covariance matrix to the actual covariance matrix?
  • PaperOlivier Ledoit and Michael Wolf (2004). A well-conditioned estimator for large-dimensional covariance matricesThe origin of the linear-shrinkage estimator discussed below.

These works are cited as sources to read, not reproduced. All exposition, examples and problems on this site are written independently; where an argument is standard, the citation points to a canonical treatment.

Results stated on this page

Problems (4)

All problems