🧮 Brain Teaser

The Covariance That Tells You the Graph

Suppose X=(X1,X2,…,Xp)X = (X_1, X_2, \ldots, X_p) is a multivariate Gaussian random vector with mean zero and covariance matrix Σ\Sigma. Let Θ=Σ−1\Theta = \Sigma^{-1} be the precision matrix.

The puzzle: Show that θij=0\theta_{ij} = 0 (the (i,j)(i,j) entry of Θ\Theta is zero) if and only if Xi⊥ ⁣ ⁣ ⁣⊥Xj∣XrestX_i \perp\!\!\!\perp X_j \mid X_{\text{rest}}, i.e., XiX_i and XjX_j are conditionally independent given all other variables.

In other words: the zeros of the precision matrix encode the conditional independence graph. Why?

Gaussian graphical modelsconditional independenceprecision matrixpartial correlationgraphical lasso

Answer: Precision Matrix and Conditional Independence

Key Idea / Intuition

For a Gaussian, everything is determined by means and covariances — and conditional distributions are still Gaussian. The key insight is that conditioning on other variables corresponds to a partial regression, and the precision matrix entry θij\theta_{ij} is (up to scaling) precisely the partial correlation between XiX_i and XjX_j after removing the linear influence of all other variables. When this partial correlation is zero, the two variables are conditionally independent — because for Gaussians, zero correlation equals independence.


Formal Proof / Solution

Step 1: Partition and the conditional distribution.

Without loss of generality, consider variables X1,X2X_1, X_2, and Xrest=(X3,…,Xp)X_{\text{rest}} = (X_3, \ldots, X_p). Write the joint density as

f(x)∝exp⁡ ⁣(−12xTΘx).f(x) \propto \exp\!\left(-\tfrac{1}{2} x^T \Theta x\right).

We want to check whether X1⊥ ⁣ ⁣ ⁣⊥X2∣XrestX_1 \perp\!\!\!\perp X_2 \mid X_{\text{rest}}.

Step 2: Factor the exponent.

The conditional density of (X1,X2)(X_1, X_2) given XrestX_{\text{rest}} is proportional to f(x)f(x) viewed as a function of (x1,x2)(x_1, x_2) with xrestx_{\text{rest}} fixed. The cross-term between x1x_1 and x2x_2 in the exponent is

xTΘx⊃2θ12x1x2.x^T \Theta x \supset 2\theta_{12} x_1 x_2.

All other terms involving x1x_1 or x2x_2 factor into functions of x1x_1 alone or x2x_2 alone (after completing the square in xrestx_{\text{rest}}).

So the conditional density factors as:

f(x1,x2∣xrest)∝exp⁡ ⁣(−θ12x1x2−12θ11x12−12θ22x22+(linear terms in x1,x2)).f(x_1, x_2 \mid x_{\text{rest}}) \propto \exp\!\left(-\theta_{12} x_1 x_2 - \tfrac{1}{2}\theta_{11}x_1^2 - \tfrac{1}{2}\theta_{22}x_2^2 + \text{(linear terms in } x_1, x_2\text{)}\right).

Step 3: Conditional independence iff no cross term.

The conditional density of (X1,X2)∣Xrest(X_1, X_2) \mid X_{\text{rest}} factors into g(x1,xrest)⋅h(x2,xrest)g(x_1, x_{\text{rest}}) \cdot h(x_2, x_{\text{rest}}) if and only if there is no x1x2x_1 x_2 cross-term in the exponent, i.e.,

θ12=0.\theta_{12} = 0.

When θ12=0\theta_{12} = 0, the joint conditional density factors, so X1⊥ ⁣ ⁣ ⁣⊥X2∣XrestX_1 \perp\!\!\!\perp X_2 \mid X_{\text{rest}}.

Step 4: The precision entry is the partial correlation (up to scaling).

One can make this even more concrete. By the formula for the inverse of a partitioned matrix, the (1,2)(1,2) entry of Θ=Σ−1\Theta = \Sigma^{-1} satisfies

θ12=−Cov(X1,X2∣Xrest)Var(X1∣Xrest)⋅Var(X2∣Xrest),\theta_{12} = -\frac{\text{Cov}(X_1, X_2 \mid X_{\text{rest}})}{\text{Var}(X_1 \mid X_{\text{rest}}) \cdot \text{Var}(X_2 \mid X_{\text{rest}})},

which is (up to sign and scaling) the partial correlation ρ12⋅rest\rho_{12 \cdot \text{rest}}. So:

θ12=0  ⟺  ρ12⋅rest=0  ⟺  X1⊥ ⁣ ⁣ ⁣⊥X2∣Xrest(Gaussian case).\theta_{12} = 0 \iff \rho_{12 \cdot \text{rest}} = 0 \iff X_1 \perp\!\!\!\perp X_2 \mid X_{\text{rest}} \quad \text{(Gaussian case)}.

Summary:

θij=0  ⟺  Xi⊥ ⁣ ⁣ ⁣⊥Xj∣Xrest\boxed{\theta_{ij} = 0 \iff X_i \perp\!\!\!\perp X_j \mid X_{\text{rest}}}

This is why the sparsity pattern of Θ\Theta is the Gaussian graphical model: an edge is absent between ii and jj exactly when θij=0\theta_{ij} = 0, i.e., when XiX_i and XjX_j are conditionally independent. Estimating Θ\Theta with an ℓ1\ell_1 penalty (graphical lasso) thus directly recovers the graph structure by driving small θij\theta_{ij} entries to zero.

Source: The Elements of Statistical Learning, Hastie, Tibshirani et al., 2nd ed., Chapter 17

Type: ML/StatsSource: The Elements of Statistical Learning, Hastie, Tibshirani et al., 2nd ed., Chapter 17Edit on GitHub ↗