Tutorials › Multivariate Statistics (Graduate) › Diagnostics For Fitted Gaussian Graphical Models

Sparse Precision and Graphical Models · Tutorial 849 of 975

Diagnostics For Fitted Gaussian Graphical Models

Use complementary diagnostics to detect model misfit, fragile edges, and observations that materially affect a fitted Gaussian graph.

Advanced 12 min read

What You'll Learn

  • Calculate standardized conditional residuals from a fitted precision matrix.
  • Interpret residual patterns without treating training residuals as independent standard normal values.
  • Compare candidate graphs using held-out Gaussian log likelihood.
  • Measure how often selected edges recur across resamples.
  • Distinguish an unusual observation from one that changes the fitted graph.
  • Identify calibration limits that matter in high-dimensional settings.

Why Diagnose a Fitted Graph?

A sparse precision estimate can produce a plausible-looking graph without adequately describing the data. An omitted nonlinear relationship, a heavy-tailed variable, or a small number of unusual observations can affect both the fitted conditional distributions and the selected edges. Diagnostics therefore ask several distinct questions: do the conditional models leave systematic residual patterns, does the fitted distribution predict new observations well, do selected edges recur under resampling, and does a particular observation substantially change the fit?

These checks are complementary, not interchangeable. A graph can predict well while some individual edges are unstable, or an edge can recur reliably even when the Gaussian distribution misses tail behavior. In high dimensions, residuals and edge frequencies are also affected by estimation and tuning. They are evidence for assessing a model, not automatic certificates that it is correct.

Definition: A diagnostic for a fitted Gaussian graphical model is a check of some feature of the fitted distribution or graph against observed or held-out data. In this tutorial, the main checks are standardized conditional residuals, held-out log likelihood, resampling-based edge frequencies, and changes in the fit after deleting influential observations.

Conditional Residuals

Let \(X\in\mathbb{R}^p\) have a multivariate Gaussian distribution with mean \(\mu\) and positive-definite precision matrix \(\Omega\), so its covariance matrix is \(\Omega^{-1}\). The conditional distribution of one coordinate given all the others is particularly useful for checking a Gaussian graphical model.

Result: For each coordinate \(j\), \(X_j\mid X_{-j}=x_{-j}\) is normal with conditional mean \(\mu_j-\Omega_{jj}^{-1}\Omega_{j,-j}(x_{-j}-\mu_{-j})\) and conditional variance \(1/\Omega_{jj}\). For an observation \(x_i\), its standardized conditional residual is \[ r_{ij}=\sqrt{\Omega_{jj}}\left[(x_{ij}-\mu_j)+\Omega_{jj}^{-1}\Omega_{j,-j}(x_{i,-j}-\mu_{-j})\right]. \]

Under the model with its true parameters, each \(r_{ij}\) has a standard normal marginal distribution. The residual checks whether the observed coordinate is surprising given the other coordinates according to the fitted conditional model. Plotting residuals against fitted conditional means, other variables, or time can reveal trends, changing variance, clusters, or extreme tails that a Gaussian conditional distribution does not capture.

Derivation: Write \(y=x-\mu\). In the Gaussian density, the part of the exponent involving \(y_j\), with \(y_{-j}\) fixed, is \[ -\frac{1}{2}\left(\Omega_{jj}y_j^2+2y_j\Omega_{j,-j}y_{-j}\right). \] Completing the square gives \[ -\frac{\Omega_{jj}}{2}\left(y_j+\Omega_{jj}^{-1}\Omega_{j,-j}y_{-j}\right)^2 \] plus terms not involving \(y_j\). Thus the conditional mean shift is \(-\Omega_{jj}^{-1}\Omega_{j,-j}y_{-j}\), and the conditional variance is \(\Omega_{jj}^{-1}\). Standardizing this conditional normal variable gives \(r_{ij}\sim N(0,1)\) when \(\mu\) and \(\Omega\) are the true parameters. \(\square\)

For a fitted model, replace \(\mu,\Omega\) by estimates. Training residuals are not exactly standard normal: the same observations helped determine those estimates, and regularization adds further dependence. When feasible, calculate diagnostics on held-out observations or use cross-fitting, in which each observation is evaluated using a model fitted without it. Examine residuals across variables and observations rather than interpreting one large value in isolation.

Worked Example: Computing Conditional Residuals

Suppose a two-variable model has known mean \(\mu=(0,0)\) and precision matrix \[ \Omega=\begin{pmatrix}1&-0.5\\-0.5&1\end{pmatrix}. \] For the observation \(x=(2,0)\), calculate both standardized conditional residuals.

For coordinate 1, the conditional mean given \(X_2=0\) is \(0-(-0.5)(0)=0\), and the conditional variance is \(1/\Omega_{11}=1\). Hence \(r_1=(2-0)/1=2\).

For coordinate 2, the conditional mean given \(X_1=2\) is \(0-(-0.5)(2)=1\), and the conditional variance is also 1. Hence \(r_2=(0-1)/1=-1\).

The observation is two conditional standard deviations above the fitted conditional mean for coordinate 1 and one below it for coordinate 2. The two residuals describe different conditional checks; they should not be treated as independent measurements.

Held-Out Log Likelihood

Residual plots are useful for finding particular patterns, while held-out likelihood summarizes predictive performance. Suppose a model fitted to training data gives mean \(\hat{\mu}\) and positive-definite precision estimate \(\hat{\Omega}\). Its log density for a held-out vector \(x\) is \[ \ell(x)=-\frac{p}{2}\log(2\pi)+\frac{1}{2}\log\det(\hat{\Omega})-\frac{1}{2}(x-\hat{\mu})^\mathsf{T}\hat{\Omega}(x-\hat{\mu}). \] For a held-out set, add these contributions or report their average. Larger average log likelihood means better predictive density on that set. All candidate models must be scored on the same held-out observations and with the same treatment of the mean and variables.

Result: If held-out observations have density \(q\), and a candidate model has density \(p\), then, provided the expectations exist, \[ E_q[\log p(X)] = E_q[\log q(X)]-D_{\mathrm{KL}}(q\|p), \] where \(D_{\mathrm{KL}}(q\|p)=E_q[\log(q(X)/p(X))]\geq 0\). Therefore expected log score is maximized by the true density \(q\), among candidate densities for which the divergence is defined.

To verify the inequality, put \(U=p(X)/q(X)\) for \(X\sim q\), assuming \(p\) is positive wherever \(q\) is positive. Then \(E_q[U]\leq 1\), allowing for candidate probability outside the support of \(q\). Jensen's inequality for the concave logarithm gives \(E_q[\log U]\leq\log E_q[U]\leq 0\). Rearranging yields \(E_q[\log q(X)]-E_q[\log p(X)]\geq0\), which is the claimed result. Equality requires \(p=q\) \(q\)-almost everywhere. \(\square\)

This result concerns expected predictive score, not the score on every finite test set. A single held-out set can favor a worse model by chance. In high dimensions, the fitted precision must give a valid positive-definite density for this Gaussian score to be defined. Keep all fitting, scaling, and tuning decisions inside the training data; using held-out observations to choose the model makes the reported score optimistic.

Worked Example: Comparing Two Held-Out Scores

Compare two zero-mean bivariate Gaussian models on two held-out observations, \(x_1=(1,1)\) and \(x_2=(-1,-1)\). Model A has \(\Omega_A=I\); Model B has \[ \Omega_B=\begin{pmatrix}1&-0.5\\-0.5&1\end{pmatrix}. \]

For either observation, Model A has \(\log\det(\Omega_A)=0\) and quadratic form \(x^\mathsf{T}\Omega_Ax=2\). Its log score is \(-\log(2\pi)-1\), approximately \(-2.8379\).

For Model B, \(\det(\Omega_B)=1-0.25=0.75\). For \(x=(1,1)\), the quadratic form is \(1+1-2(0.5)=1\); for \(x=(-1,-1)\), it is also 1. Each log score is therefore \[ -\log(2\pi)+\frac12\log(0.75)-\frac12(1)\approx-2.4817. \] The average held-out score is approximately \(-2.8379\) for A and \(-2.4817\) for B, so B scores higher on these observations. This small test set is illustrative, not decisive evidence that B predicts better in general.

Edge Stability and Observation Influence

An edge in a fitted graph is a selected nonzero off-diagonal precision entry. Its recurrence across resamples is a useful sensitivity diagnostic. For a chosen resampling procedure, define the selection frequency of edge \((j,k)\) as the fraction of resampled fits in which that edge is selected. The procedure should specify the subsampling scheme, fitting method, and how tuning is chosen. If tuning is repeated within each resample, the frequency reflects the full selection pipeline; if tuning is fixed, it reflects stability conditional on that choice.

A high frequency indicates that an edge is relatively insensitive to the particular resamples used, not that the edge is certainly a true conditional dependence. Frequencies can change with sample size, tuning, scaling, or the resampling design. Compare the frequencies of scientifically important edges and inspect whether the same broader neighborhoods recur, rather than treating a universal cutoff as a guarantee.

Worked Example: Interpreting Edge Frequencies

A specified subsampling procedure produces 20 fitted graphs. Edge \((1,2)\) appears in 18 graphs, edge \((1,3)\) in 11, and edge \((2,3)\) in 4. Their selection frequencies are respectively \(18/20=0.90\), \(11/20=0.55\), and \(4/20=0.20\).

The evidence suggests that \((1,2)\) is more stable under this particular pipeline than the other two edges. The frequency 0.90 is not a 90% probability that the edge is true: it is a fraction of resampled fits, conditional on the data, the resampling design, and the fitting and tuning rules. The frequency 0.20 flags \((2,3)\) as especially sensitive and cautions against presenting it as a robust feature without further evidence.

An observation is influential when removing it and refitting materially changes quantities of interest, such as selected edges, estimated precision entries, or held-out predictions. An unusually large conditional residual can prompt this check, but unusualness alone does not establish influence. Conversely, a point may affect covariance structure without having an extreme residual under a model that has already been pulled toward it. A practical analysis records the change from the full fit to a leave-one-out fit and checks whether the change is large relative to ordinary resampling variation.

Worked Example: One Observation Creates a Selected Edge

Consider four centered observations in two dimensions: \((1,0),(-1,0),(0,1),(0,-1)\). Estimate the covariance with mean fixed at zero, using divisor \(n\). The covariance estimate is \[ \hat{\Sigma}=\frac14\sum_{i=1}^4x_ix_i^\mathsf{T} =\begin{pmatrix}0.5&0\\0&0.5\end{pmatrix}, \] so its inverse is diagonal and the fitted graph has no edge between the variables.

Now add the observation \((3,3)\) and again use mean zero and divisor \(n=5\). The new covariance estimate is \[ \hat{\Sigma}=\frac15\begin{pmatrix}11&9\\9&11\end{pmatrix} =\begin{pmatrix}2.2&1.8\\1.8&2.2\end{pmatrix}. \] Its determinant is \(2.2^2-1.8^2=1.6\), so it is positive definite. Its inverse is \[ \hat{\Omega}=\frac{1}{1.6}\begin{pmatrix}2.2&-1.8\\-1.8&2.2\end{pmatrix}, \] whose off-diagonal entries are \(-1.125\). The added observation changes the fitted graph from no edge to an edge in this unpenalized example. This is a concrete influence warning, not proof that the observation is erroneous: the model, mean assumption, and intended population all require scrutiny.

Common Pitfall and Practical Use

Wrong reasoning: “Every fitted conditional residual should be an independent standard normal, so I can flag every large training residual against a standard normal cutoff and trust the remaining graph.” This fails twice. Estimated training residuals are not independent standard normal observations, and checking many coordinates creates many chances for an apparently extreme value. In addition, a residual check does not establish that selected edges are stable or that new observations receive good predictive scores.

Correction: use held-out or cross-fitted residuals where possible, look for systematic patterns across observations and variables, and interpret extremes with the number of checks and the fitting procedure in mind. Pair those checks with held-out log likelihood, resampling-based edge stability, and targeted deletion refits for potentially influential cases. These diagnostics answer different questions and should be reported as such.

Key takeaway: Diagnose a fitted Gaussian graph from multiple angles. Conditional residuals probe the conditional distributions; held-out log likelihood assesses predictive density; edge frequencies assess resampling sensitivity; and deletion refits assess influence. None alone proves that the graph is correct.

Check Your Understanding

Answer each question by referring to the assumptions and limitations of the diagnostic, not just its numerical output.

  1. What are the conditional mean and variance of \(X_j\mid X_{-j}\) in terms of the precision matrix?
  2. Why are fitted training conditional residuals not generally independent standard normal values?
  3. What does a higher average held-out log likelihood indicate, and why can one small test set still favor the poorer model?
  4. An edge appears in 19 of 20 resampled fits. What does this frequency support, and what does it not establish?
  5. Why is a large residual not, by itself, proof that an observation is influential?
  6. Give two distinct diagnostics you would use if an edge changes when one observation is removed.
Clinical Biostats